com.google.common.util.concurrent
Class ForwardingFuture<V>
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
public abstract class ForwardingFuture<V>
- extends ForwardingObject
- implements Future<V>
A ForwardingFuture.SimpleForwardingFuture
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
Constructor Summary |
protected |
ForwardingFuture()
Constructor for use by subclasses. |
ForwardingFuture
protected ForwardingFuture()
- Constructor for use by subclasses.
delegate
protected abstract Future<V> 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 as
ForwardingSet.delegate()
. Concrete subclasses override this method to supply
the instance being decorated.
- Specified by:
delegate
in class ForwardingObject
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface Future<V>
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface Future<V>
isDone
public boolean isDone()
- Specified by:
isDone
in interface Future<V>
get
public V get()
throws InterruptedException,
ExecutionException
- Specified by:
get
in interface Future<V>
- Throws:
InterruptedException
ExecutionException
get
public V get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
- Specified by:
get
in interface Future<V>
- Throws:
InterruptedException
ExecutionException
TimeoutException
Copyright © 2010-2011. All Rights Reserved.