本文整理汇总了Java中com.google.common.util.concurrent.AbstractFutureTest.TimedWaiterThread.awaitWaiting方法的典型用法代码示例。如果您正苦于以下问题:Java TimedWaiterThread.awaitWaiting方法的具体用法?Java TimedWaiterThread.awaitWaiting怎么用?Java TimedWaiterThread.awaitWaiting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.util.concurrent.AbstractFutureTest.TimedWaiterThread
的用法示例。
在下文中一共展示了TimedWaiterThread.awaitWaiting方法的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();
}