List of usage examples for com.google.common.util.concurrent UncheckedTimeoutException UncheckedTimeoutException
public UncheckedTimeoutException()
From source file:io.prestosql.tests.AbstractTestDistributedQueries.java
private <T> T waitUntilStable(Supplier<T> computation, Duration timeout) { T lastValue = computation.get();// www . jav a 2s . c om long start = System.nanoTime(); while (!currentThread().isInterrupted() && nanosSince(start).compareTo(timeout) < 0) { sleepUninterruptibly(100, MILLISECONDS); T currentValue = computation.get(); if (currentValue.equals(lastValue)) { return currentValue; } lastValue = currentValue; } throw new UncheckedTimeoutException(); }