本文整理汇总了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();
}
示例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());
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}