|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.ForwardingObject com.google.common.util.concurrent.ForwardingFuture<V>
public abstract class ForwardingFuture<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.
Constructor Summary | |
---|---|
protected |
ForwardingFuture()
Constructor for use by subclasses. |
Method Summary | |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task. |
protected abstract Future<V> |
delegate()
Returns the backing delegate instance that methods are forwarded to. |
V |
get()
Waits if necessary for the computation to complete, and then retrieves its result. |
V |
get(long timeout,
TimeUnit unit)
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. |
boolean |
isCancelled()
Returns true if this task was cancelled before it completed normally. |
boolean |
isDone()
Returns true if this task completed. |
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 |
Constructor Detail |
---|
protected ForwardingFuture()
Method Detail |
---|
protected abstract Future<V> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply
the instance being decorated.
delegate
in class ForwardingObject
public boolean cancel(boolean mayInterruptIfRunning)
java.util.concurrent.Future
After this method returns, subsequent calls to Future.isDone()
will
always return true. Subsequent calls to Future.isCancelled()
will always return true if this method returned true.
cancel
in interface Future<V>
mayInterruptIfRunning
- true if the thread executing this
task should be interrupted; otherwise, in-progress tasks are allowed
to complete
public boolean isCancelled()
java.util.concurrent.Future
isCancelled
in interface Future<V>
public boolean isDone()
java.util.concurrent.Future
isDone
in interface Future<V>
public V get() throws InterruptedException, ExecutionException
java.util.concurrent.Future
get
in interface Future<V>
InterruptedException
- if the current thread was interrupted
while waiting
ExecutionException
- if the computation threw an
exceptionpublic V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
java.util.concurrent.Future
get
in interface Future<V>
timeout
- the maximum time to waitunit
- the time unit of the timeout argument
InterruptedException
- if the current thread was interrupted
while waiting
ExecutionException
- if the computation threw an
exception
TimeoutException
- if the wait timed out
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |