com.google.common.util.concurrent.AbstractFutureTest.TimedWaiterThread

Here are the examples of the java api class com.google.common.util.concurrent.AbstractFutureTest.TimedWaiterThread taken from open source projects.

1. AbstractAbstractFutureTest#testOverflowTimeout()

View license
// threads
@GwtIncompatible
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();
}