makeCompleteListFuture(futures); final SettableListenableFuture<List<T>> result = new CancelDelegateSettableListenableFuture<>(completeFuture, null);
@Override public void handleResult(List<ListenableFuture<?>> failedFutures) { if (failedFutures.isEmpty()) { resultFuture.setResult(result); } else { // propagate error ListenableFuture<?> f = failedFutures.get(0); if (f.isCancelled()) { resultFuture.cancelRegardlessOfDelegateFutureState(false); } else { try { f.get(); } catch (ExecutionException e) { resultFuture.setFailure(e.getCause()); } catch (InterruptedException e) { // should not be possible throw new RuntimeException(e); } } } }
@Override public void handleResult(T result) { resultFuture.setRunningThread(Thread.currentThread()); try { while (loopTest.test(result)) { if (startTime > -1 && Clock.lastKnownForwardProgressingMillis() - startTime > timeoutMillis) { if (lastValueOnTimeout) { resultFuture.setResult(result); } else { resultFuture.setFailure(new TimeoutException()); if (resultFuture.isCancelled()) { } catch (ExecutionException e) { resultFuture.setFailure(e.getCause()); return; resultFuture.updateDelegateFuture(lf); lf.addCallback(this); return; resultFuture.setResult(result); } catch (Throwable t) { resultFuture.setFailure(t); } finally { resultFuture.setRunningThread(null);
new CancelDelegateSettableListenableFuture<>(startingFuture, scheduler); Callable<T> cancelCheckingTask = new Callable<T>() { @Override
new CancelDelegateSettableListenableFuture<>(startingFuture, scheduler); Callable<T> cancelCheckingTask = new Callable<T>() { @Override
new CancelDelegateSettableListenableFuture<>(startingFuture, null);
makeCompleteListFuture(futures); final SettableListenableFuture<List<T>> result = new CancelDelegateSettableListenableFuture<>(completeFuture, null);
new CancelDelegateSettableListenableFuture<>(sourceFuture, executor);
new CancelDelegateSettableListenableFuture<>(sourceFuture, executor);
new CancelDelegateSettableListenableFuture<>(ffc, null); ffc.addCallback(new FutureCallback<List<ListenableFuture<?>>>() { @Override
new CancelDelegateSettableListenableFuture<>(sourceFuture, executor);
new CancelDelegateSettableListenableFuture<>(sourceFuture, executor);
} else { SettableListenableFuture<RT> slf = new CancelDelegateSettableListenableFuture<>(sourceFuture, executor);
new CancelDelegateSettableListenableFuture<>(ffc, null); ffc.addCallback(new FutureCallback<List<ListenableFuture<?>>>() { @Override
new CancelDelegateSettableListenableFuture<>(startingFuture, null);
} else { CancelDelegateSettableListenableFuture<RT> slf = new CancelDelegateSettableListenableFuture<>(sourceFuture, executor); sourceFuture.addCallback(new FailurePropogatingFutureCallback<ST>(slf) { @Override
} else { SettableListenableFuture<RT> slf = new CancelDelegateSettableListenableFuture<>(sourceFuture, executor);
} else { CancelDelegateSettableListenableFuture<RT> slf = new CancelDelegateSettableListenableFuture<>(sourceFuture, executor); sourceFuture.addCallback(new FailurePropogatingFutureCallback<ST>(slf) { @Override
new CancelDelegateSettableListenableFuture<>(efc, null); efc.addCallback(new FutureCallback<Object>() { @Override
return cancelRegardlessOfDelegateFutureState(true); if (isDone()) { return false; boolean callListeners = false; synchronized (resultLock) { if (! isDone()) { if (delegateFuture.cancel(false)) { canceled = true; if (! isDone()) { // may have transitioned to canceled already as a listener (within lock) callListeners = true; setCanceled();