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:
- java.util.concurrent.Future<V>
@Beta
public abstract class ForwardingFuture<V>
- extends ForwardingObject
- implements java.util.concurrent.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 collection as desired per the decorator pattern.
- Since:
- 1
- Author:
- Sven Mawson
- See Also:
ForwardingObject
Method Summary |
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()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ForwardingFuture
public ForwardingFuture()
delegate
protected abstract java.util.concurrent.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 java.util.concurrent.Future<V>
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface java.util.concurrent.Future<V>
isDone
public boolean isDone()
- Specified by:
isDone
in interface java.util.concurrent.Future<V>
get
public V get()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
- Specified by:
get
in interface java.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
get
public V get(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
- Specified by:
get
in interface java.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
Copyright © 2010 Google. All Rights Reserved.