public abstract class ForwardingFuture<V> extends ForwardingObjectimplements 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
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 Future |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
V |
get()
|
V |
get(long timeout, TimeUnit
|
boolean |
isCancelled()
|
boolean |
isDone()
|
toStringprotected abstract Future<V> delegate()
ForwardingObject
ForwardingSet.delegate() . Concrete subclasses override this method to supply the instance being decorated.
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
public boolean isDone()
public V get() throws InterruptedException, ExecutionException
get in interface
Future<V>
InterruptedException
ExecutionException
public V get(long timeout, TimeUnitunit) throws InterruptedException , ExecutionException , TimeoutException
get in interface
Future<V>
InterruptedException
ExecutionException
TimeoutException