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 classprivate final classprivate classNested classes/interfaces inherited from class com.google.common.util.concurrent.AggregateFuture
AggregateFuture.ReleaseResourcesReasonNested 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) voidcollectOneValue(int index, Object returnValue) IfallMustSucceedis true, called as each future completes; otherwise, ifcollectsValuesis true, called for each future when all futures complete.(package private) voidprotected voidSubclasses can override this method to implement interruption of the future's computation.(package private) voidClears 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, pendingToStringMethods inherited from class com.google.common.util.concurrent.AggregateFutureState
clearSeenExceptions, decrementRemainingAndGet, getOrInitSeenExceptionsMethods inherited from class com.google.common.util.concurrent.AbstractFuture.TrustedFuture
addListener, cancel, get, get, isCancelled, isDoneMethods inherited from class com.google.common.util.concurrent.AbstractFuture
maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterruptedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:AggregateFutureIfallMustSucceedis true, called as each future completes; otherwise, ifcollectsValuesis true, called for each future when all futures complete.- Specified by:
collectOneValuein classAggregateFuture<Object,V>
-
handleAllCompleted
void handleAllCompleted()- Specified by:
handleAllCompletedin classAggregateFuture<Object,V>
-
releaseResources
Description copied from class:AggregateFutureClears 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
afterCommitmethod but not quite the same. See the description of CL 265462958.- Overrides:
releaseResourcesin classAggregateFuture<Object,V>
-
interruptTask
protected void interruptTask()Description copied from class:AbstractFutureSubclasses 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:
interruptTaskin classAbstractFuture<V>
-