(final Duration timeout)
| 436 | } |
| 437 | |
| 438 | @Override |
| 439 | public final void join(final Duration timeout) throws CheckedFutureException { |
| 440 | final ReleaseOnRunLatch latch = new ReleaseOnRunLatch(); |
| 441 | ensure(latch); |
| 442 | try { |
| 443 | if (!latch.tryAcquireSharedNanos(1, timeout.toNanos())) |
| 444 | throw new TimeoutException(); |
| 445 | } catch (final InterruptedException ex) { |
| 446 | throw new CheckedFutureException(ex); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | private static class Map<T, R> extends Continuation<T, R> { |
| 451 | private final Function<? super T, ? extends R> f; |