本文整理汇总了Java中com.google.common.util.concurrent.AbstractFutureTest.TimedWaiterThread类的典型用法代码示例。如果您正苦于以下问题:Java TimedWaiterThread类的具体用法?Java TimedWaiterThread怎么用?Java TimedWaiterThread使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimedWaiterThread类属于com.google.common.util.concurrent.AbstractFutureTest包,在下文中一共展示了TimedWaiterThread类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOverflowTimeout
import com.google.common.util.concurrent.AbstractFutureTest.TimedWaiterThread; //导入依赖的package包/类
@GwtIncompatible // threads
public void testOverflowTimeout() throws Exception {
// First, sanity check that naive multiplication would really overflow to a negative number:
long nanosPerSecond = NANOSECONDS.convert(1, SECONDS);
assertThat(nanosPerSecond * Long.MAX_VALUE).isLessThan(0L);
// Check that we wait long enough anyway (presumably as long as MAX_VALUE nanos):
TimedWaiterThread waiter = new TimedWaiterThread(future, Long.MAX_VALUE, SECONDS);
waiter.start();
waiter.awaitWaiting();
future.set(1);
waiter.join();
}