(
ListenableFuture<V> delegate,
long time,
TimeUnit unit,
ScheduledExecutorService scheduledExecutor)
| 36 | @GwtIncompatible |
| 37 | final class TimeoutFuture<V> extends AbstractFuture.TrustedFuture<V> { |
| 38 | static <V> ListenableFuture<V> create( |
| 39 | ListenableFuture<V> delegate, |
| 40 | long time, |
| 41 | TimeUnit unit, |
| 42 | ScheduledExecutorService scheduledExecutor) { |
| 43 | TimeoutFuture<V> result = new TimeoutFuture<V>(delegate); |
| 44 | TimeoutFuture.Fire<V> fire = new TimeoutFuture.Fire<V>(result); |
| 45 | result.timer = scheduledExecutor.schedule(fire, time, unit); |
| 46 | delegate.addListener(fire, directExecutor()); |
| 47 | return result; |
| 48 | } |
| 49 | |
| 50 | /* |
| 51 | * Memory visibility of these fields. There are two cases to consider. |
no test coverage detected