Class CollectionFuture<V,C>
java.lang.Object
com.google.common.util.concurrent.internal.InternalFutureFailureAccess
com.google.common.util.concurrent.AbstractFuture<C>
com.google.common.util.concurrent.AbstractFuture.TrustedFuture<C>
com.google.common.util.concurrent.AggregateFutureState<C>
com.google.common.util.concurrent.AggregateFuture<V,C>
com.google.common.util.concurrent.CollectionFuture<V,C>
- All Implemented Interfaces:
AbstractFuture.Trusted<C>
,ListenableFuture<C>
,Future<C>
- Direct Known Subclasses:
CollectionFuture.ListFuture
Aggregate future that collects (stores) results of each future.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
private static final class
The result of a successfulFuture
.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
ConstructorsConstructorDescriptionCollectionFuture
(ImmutableCollection<? extends ListenableFuture<? extends V>> futures, boolean allMustSucceed) -
Method Summary
Modifier and TypeMethodDescription(package private) final void
collectOneValue
(int index, V returnValue) IfallMustSucceed
is true, called as each future completes; otherwise, ifcollectsValues
is true, called for each future when all futures complete.(package private) abstract C
combine
(List<CollectionFuture.Present<V>> values) (package private) final void
(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
interruptTask, 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
-
values
-
-
Constructor Details
-
CollectionFuture
CollectionFuture(ImmutableCollection<? extends ListenableFuture<? extends V>> futures, boolean allMustSucceed)
-
-
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<V,
C>
-
handleAllCompleted
final void handleAllCompleted()- Specified by:
handleAllCompleted
in classAggregateFuture<V,
C>
-
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<V,
C>
-
combine
-