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<OutputT>
-
- com.google.common.util.concurrent.AggregateFutureState<OutputT>
-
- com.google.common.util.concurrent.AggregateFuture<java.lang.Object,V>
-
- com.google.common.util.concurrent.CombinedFuture<V>
-
- All Implemented Interfaces:
AbstractFuture.Trusted<V>,ListenableFuture<V>,java.util.concurrent.Future<V>
final class CombinedFuture<V> extends AggregateFuture<java.lang.Object,V>
Aggregate future that computes its value by calling a callable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classCombinedFuture.AsyncCallableInterruptibleTaskprivate classCombinedFuture.CallableInterruptibleTaskprivate classCombinedFuture.CombinedFutureInterruptibleTask<T>-
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>
-
-
Field Summary
Fields Modifier and Type Field Description private CombinedFuture.CombinedFutureInterruptibleTask<?>task
-
Constructor Summary
Constructors Constructor Description CombinedFuture(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, java.util.concurrent.Executor listenerExecutor, AsyncCallable<V> callable)CombinedFuture(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, java.util.concurrent.Executor listenerExecutor, java.util.concurrent.Callable<V> callable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidcollectOneValue(int index, java.lang.Object returnValue)IfallMustSucceedis true, called as each future completes; otherwise, ifcollectsValuesis true, called for each future when all futures complete.(package private) voidhandleAllCompleted()protected voidinterruptTask()Subclasses can override this method to implement interruption of the future's computation.(package private) voidreleaseResources(AggregateFuture.ReleaseResourcesReason reason)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
-
-
-
-
Field Detail
-
task
private CombinedFuture.CombinedFutureInterruptibleTask<?> task
-
-
Constructor Detail
-
CombinedFuture
CombinedFuture(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, java.util.concurrent.Executor listenerExecutor, AsyncCallable<V> callable)
-
CombinedFuture
CombinedFuture(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, java.util.concurrent.Executor listenerExecutor, java.util.concurrent.Callable<V> callable)
-
-
Method Detail
-
collectOneValue
void collectOneValue(int index, java.lang.Object returnValue)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<java.lang.Object,V>
-
handleAllCompleted
void handleAllCompleted()
- Specified by:
handleAllCompletedin classAggregateFuture<java.lang.Object,V>
-
releaseResources
void releaseResources(AggregateFuture.ReleaseResourcesReason reason)
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<java.lang.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>
-
-