Class CollectionFuture<V,C>
- 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<V,C>
-
- com.google.common.util.concurrent.CollectionFuture<V,C>
-
- All Implemented Interfaces:
AbstractFuture.Trusted<C>
,ListenableFuture<C>
,java.util.concurrent.Future<C>
- Direct Known Subclasses:
CollectionFuture.ListFuture
abstract class CollectionFuture<V,C> extends AggregateFuture<V,C>
Aggregate future that collects (stores) results of each future.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
CollectionFuture.ListFuture<V>
private static class
CollectionFuture.Present<V>
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>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<CollectionFuture.Present<V>>
values
-
Constructor Summary
Constructors Constructor Description CollectionFuture(ImmutableCollection<? extends ListenableFuture<? extends V>> futures, boolean allMustSucceed)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) 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(java.util.List<CollectionFuture.Present<V>> values)
(package private) void
handleAllCompleted()
(package private) void
releaseResources(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
interruptTask, maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterrupted
-
-
-
-
Field Detail
-
values
private java.util.List<CollectionFuture.Present<V>> values
-
-
Constructor Detail
-
CollectionFuture
CollectionFuture(ImmutableCollection<? extends ListenableFuture<? extends V>> futures, boolean allMustSucceed)
-
-
Method Detail
-
collectOneValue
final void collectOneValue(int index, V returnValue)
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
void releaseResources(AggregateFuture.ReleaseResourcesReason reason)
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
abstract C combine(java.util.List<CollectionFuture.Present<V>> values)
-
-