public abstract class ForwardingFuture<V> extends ForwardingObject implements java.util.concurrent.Future<V>
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
ForwardingFuture.SimpleForwardingFuture<V>
A simplified version of
ForwardingFuture where subclasses
can pass in an already constructed Future as the delegate. |
| Modifier | Constructor and Description |
|---|---|
protected |
ForwardingFuture()
Constructor for use by subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
protected abstract java.util.concurrent.Future<V> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
V |
get() |
V |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
toStringprotected abstract java.util.concurrent.Future<V> delegate()
ForwardingObjectForwardingSet.delegate(). Concrete subclasses override this method to supply
the instance being decorated.delegate in class ForwardingObjectpublic boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<V>public boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<V>public boolean isDone()
isDone in interface java.util.concurrent.Future<V>public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<V>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get in interface java.util.concurrent.Future<V>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutException