Class CombinedFuture<V>
java.lang.Object
com.google.common.util.concurrent.internal.InternalFutureFailureAccess
com.google.common.util.concurrent.AbstractFuture<V>
com.google.common.util.concurrent.AbstractFuture.TrustedFuture<V>
com.google.common.util.concurrent.AggregateFutureState<V>
com.google.common.util.concurrent.AggregateFuture<Object,V>
com.google.common.util.concurrent.CombinedFuture<V>
- All Implemented Interfaces:
AbstractFuture.Trusted<V>
,ListenableFuture<V>
,Future<V>
Aggregate future that computes its value by calling a callable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
private final class
private class
Nested classes/interfaces inherited from class com.google.common.util.concurrent.AggregateFuture
AggregateFuture.ReleaseResourcesReason
Nested classes/interfaces inherited from class com.google.common.util.concurrent.AbstractFuture
AbstractFuture.Trusted<V>, AbstractFuture.TrustedFuture<V>
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
FieldsFields inherited from class com.google.common.util.concurrent.AbstractFuture
GENERATE_CANCELLATION_CAUSES
-
Constructor Summary
ConstructorsConstructorDescriptionCombinedFuture
(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, Executor listenerExecutor, AsyncCallable<V> callable) CombinedFuture
(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, Executor listenerExecutor, Callable<V> callable) -
Method Summary
Modifier and TypeMethodDescription(package private) void
collectOneValue
(int index, Object returnValue) IfallMustSucceed
is true, called as each future completes; otherwise, ifcollectsValues
is true, called for each future when all futures complete.(package private) void
protected void
Subclasses can override this method to implement interruption of the future's computation.(package private) void
Clears fields that are no longer needed after this future has completed -- or at least all its inputs have completed (more precisely, afterAggregateFuture.handleAllCompleted()
has been called).Methods inherited from class com.google.common.util.concurrent.AggregateFuture
addInitialException, afterDone, init, pendingToString
Methods inherited from class com.google.common.util.concurrent.AggregateFutureState
clearSeenExceptions, decrementRemainingAndGet, getOrInitSeenExceptions
Methods inherited from class com.google.common.util.concurrent.AbstractFuture.TrustedFuture
addListener, cancel, get, get, isCancelled, isDone
Methods inherited from class com.google.common.util.concurrent.AbstractFuture
maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterrupted
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
task
-
-
Constructor Details
-
CombinedFuture
CombinedFuture(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, Executor listenerExecutor, AsyncCallable<V> callable) -
CombinedFuture
CombinedFuture(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, Executor listenerExecutor, Callable<V> callable)
-
-
Method Details
-
collectOneValue
Description copied from class:AggregateFuture
IfallMustSucceed
is true, called as each future completes; otherwise, ifcollectsValues
is true, called for each future when all futures complete.- Specified by:
collectOneValue
in classAggregateFuture<Object,
V>
-
handleAllCompleted
void handleAllCompleted()- Specified by:
handleAllCompleted
in classAggregateFuture<Object,
V>
-
releaseResources
Description copied from class:AggregateFuture
Clears fields that are no longer needed after this future has completed -- or at least all its inputs have completed (more precisely, afterAggregateFuture.handleAllCompleted()
has been called). Often called multiple times (that is, both when the inputs complete and when the output completes).This is similar to our proposed
afterCommit
method but not quite the same. See the description of CL 265462958.- Overrides:
releaseResources
in classAggregateFuture<Object,
V>
-
interruptTask
protected void interruptTask()Description copied from class:AbstractFuture
Subclasses can override this method to implement interruption of the future's computation. The method is invoked automatically by a successful call tocancel(true)
.The default implementation does nothing.
This method is likely to be deprecated. Prefer to override
AbstractFuture.afterDone()
, checkingAbstractFuture.wasInterrupted()
to decide whether to interrupt your task.- Overrides:
interruptTask
in classAbstractFuture<V>
-