Class Futures.InCompletionOrderFuture<T>
- java.lang.Object
-
- com.google.common.util.concurrent.internal.InternalFutureFailureAccess
-
- com.google.common.util.concurrent.AbstractFuture<T>
-
- com.google.common.util.concurrent.Futures.InCompletionOrderFuture<T>
-
- All Implemented Interfaces:
ListenableFuture<T>
,java.util.concurrent.Future<T>
- Enclosing class:
- Futures
private static final class Futures.InCompletionOrderFuture<T> extends AbstractFuture<T>
-
-
Nested Class Summary
-
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 Futures.InCompletionOrderState<T>
state
-
Constructor Summary
Constructors Modifier Constructor Description private
InCompletionOrderFuture(Futures.InCompletionOrderState<T> state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterDone()
Callback method that is called exactly once after the future is completed.boolean
cancel(boolean interruptIfRunning)
protected java.lang.String
pendingToString()
Provide a human-readable explanation of why this future has not yet completed.-
Methods inherited from class com.google.common.util.concurrent.AbstractFuture
addListener, get, get, interruptTask, isCancelled, isDone, maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterrupted
-
-
-
-
Field Detail
-
state
private Futures.InCompletionOrderState<T> state
-
-
Constructor Detail
-
InCompletionOrderFuture
private InCompletionOrderFuture(Futures.InCompletionOrderState<T> state)
-
-
Method Detail
-
cancel
public boolean cancel(boolean interruptIfRunning)
Description copied from class:AbstractFuture
If a cancellation attempt succeeds on a
Future
that had previously been set asynchronously, then the cancellation will also be propagated to the delegateFuture
that was supplied in thesetFuture
call.Rather than override this method to perform additional cancellation work or cleanup, subclasses should override
AbstractFuture.afterDone()
, consultingAbstractFuture.isCancelled()
andAbstractFuture.wasInterrupted()
as necessary. This ensures that the work is done even if the future is cancelled without a call tocancel
, such as by callingsetFuture(cancelledFuture)
.- Specified by:
cancel
in interfacejava.util.concurrent.Future<T>
- Overrides:
cancel
in classAbstractFuture<T>
-
afterDone
protected void afterDone()
Description copied from class:AbstractFuture
Callback method that is called exactly once after the future is completed.If
AbstractFuture.interruptTask()
is also run during completion,AbstractFuture.afterDone()
runs after it.The default implementation of this method in
AbstractFuture
does nothing. This is intended for very lightweight cleanup work, for example, timing statistics or clearing fields. If your task does anything heavier consider, just using a listener with an executor.- Overrides:
afterDone
in classAbstractFuture<T>
-
pendingToString
protected java.lang.String pendingToString()
Description copied from class:AbstractFuture
Provide a human-readable explanation of why this future has not yet completed.- Overrides:
pendingToString
in classAbstractFuture<T>
- Returns:
- null if an explanation cannot be provided because the future is done.
-
-