java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.util.concurrent.ForwardingFuture<V>
- All Implemented Interfaces:
Future<V>
- Direct Known Subclasses:
ForwardingFuture.SimpleForwardingFuture
,ForwardingListenableFuture
@GwtCompatible
public abstract class ForwardingFuture<V extends @Nullable Object>
extends ForwardingObject
implements Future<V>
A
Future
which forwards all its method calls to another future. Subclasses should
override one or more methods to modify the behavior of the backing future as desired per the decorator pattern.
Most subclasses can just use ForwardingFuture.SimpleForwardingFuture
.
- Since:
- 1.0
- Author:
- Sven Mawson
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A simplified version ofForwardingFuture
where subclasses can pass in an already constructedFuture
as the delegate.Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Constructor Summary
-
Method Summary
Methods inherited from class com.google.common.collect.ForwardingObject
toString
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
-
Constructor Details
-
ForwardingFuture
protected ForwardingFuture()Constructor for use by subclasses.
-
-
Method Details
-
delegate
Description copied from class:ForwardingObject
Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such asForwardingSet.delegate()
. Concrete subclasses override this method to supply the instance being decorated.- Specified by:
delegate
in classForwardingObject
-
cancel
-
isCancelled
- Specified by:
isCancelled
in interfaceFuture<V extends @Nullable Object>
-
isDone
-
get
- Specified by:
get
in interfaceFuture<V extends @Nullable Object>
- Throws:
InterruptedException
ExecutionException
-
get
@CanIgnoreReturnValue public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<V extends @Nullable Object>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-