当前位置: 首页>>代码示例>>Java>>正文


Java Clock.lastKnownTimeMillis方法代码示例

本文整理汇总了Java中org.threadly.util.Clock.lastKnownTimeMillis方法的典型用法代码示例。如果您正苦于以下问题:Java Clock.lastKnownTimeMillis方法的具体用法?Java Clock.lastKnownTimeMillis怎么用?Java Clock.lastKnownTimeMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.threadly.util.Clock的用法示例。


在下文中一共展示了Clock.lastKnownTimeMillis方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TestableScheduler

import org.threadly.util.Clock; //导入方法依赖的package包/类
/**
 * Constructs a new {@link TestableScheduler} scheduler.
 * 
 * @param defaultPriority Default priority for tasks which are submitted without any specified priority
 * @param maxWaitForLowPriorityInMs time low priority tasks to wait if there are high priority tasks ready to run
 */
public TestableScheduler(TaskPriority defaultPriority, long maxWaitForLowPriorityInMs) {
  super(defaultPriority);
  
  scheduler = new InternalScheduler(defaultPriority, maxWaitForLowPriorityInMs);
  nowInMillis = Clock.lastKnownTimeMillis();
}
 
开发者ID:threadly,项目名称:threadly,代码行数:13,代码来源:TestableScheduler.java

示例2: lastTickTimeTest

import org.threadly.util.Clock; //导入方法依赖的package包/类
@Test
public void lastTickTimeTest() {
  long now = Clock.lastKnownTimeMillis();
  
  scheduler.tick(now + 1000);
  
  assertEquals(now + 1000, scheduler.getLastTickTime());
}
 
开发者ID:threadly,项目名称:threadly,代码行数:9,代码来源:TestableSchedulerTest.java

示例3: sizeStable

import org.threadly.util.Clock; //导入方法依赖的package包/类
public static boolean sizeStable(File file, 
                                 long originalSize, 
                                 long sizeCaptureTime) {
  long sizeAtStart = file.length();
  if (sizeAtStart != originalSize) {
    return sizeStable(file, sizeAtStart, Clock.lastKnownTimeMillis());
  }
  
  long elapsedTime = Clock.lastKnownTimeMillis() - sizeCaptureTime;
  if (elapsedTime < FILE_SIZE_STABILITY_TIME_IN_MILLIS - 10) {  // only sleep if we need to wait at least 10ms
    try {
      Thread.sleep(FILE_SIZE_STABILITY_TIME_IN_MILLIS - elapsedTime);
    } catch (InterruptedException e1) {
      Thread.currentThread().interrupt();
    }
  }
  
  long newSize = file.length();
  if (newSize != originalSize) {
    System.out.println("Filesize changed for file: " + file + 
                         "..." + originalSize + "/" + newSize);
    
    return false;
  } else {
    return true;
  }
}
 
开发者ID:jentfoo,项目名称:XboxMediaProcessor,代码行数:28,代码来源:FileUtils.java

示例4: ConverterWorker

import org.threadly.util.Clock; //导入方法依赖的package包/类
private ConverterWorker(AtomicInteger processedCount, 
                        int totalProcessCount, 
                        File sourceFile, File newFile) {
  originalSize = sourceFile.length();
  creationTime = Clock.lastKnownTimeMillis();
  
  this.processedCount = processedCount;
  this.totalProcessCount = totalProcessCount;
  this.sourceFile = sourceFile;
  this.newFile = newFile;
}
 
开发者ID:jentfoo,项目名称:XboxMediaProcessor,代码行数:12,代码来源:LibavConverter.java

示例5: getNowToHour

import org.threadly.util.Clock; //导入方法依赖的package包/类
private static long getNowToHour() {
  long hours = Clock.lastKnownTimeMillis() / TimeUnit.HOURS.toMillis(1);
  return TimeUnit.HOURS.toMillis(hours);
}
 
开发者ID:threadly,项目名称:threadly,代码行数:5,代码来源:SchedulingUtilsTest.java

示例6: getNowToDay

import org.threadly.util.Clock; //导入方法依赖的package包/类
private static long getNowToDay() {
  long days = Clock.lastKnownTimeMillis() / TimeUnit.DAYS.toMillis(1);
  return TimeUnit.DAYS.toMillis(days);
}
 
开发者ID:threadly,项目名称:threadly,代码行数:5,代码来源:SchedulingUtilsTest.java


注:本文中的org.threadly.util.Clock.lastKnownTimeMillis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。