public class ListenableFutureTask<T> extends FutureTask<T> implements ListenableFuture<T>
FutureTask that implements ListenableFuture.| Constructor and Description |
|---|
ListenableFutureTask(Callable<T> callable)
Creates a new
ListenableFutureTask that will, upon running, execute the given
Callable. |
ListenableFutureTask(Runnable runnable,
T result)
Creates a
ListenableFutureTask that will, upon running, execute the given
Runnable, and arrange that FutureTask.get() will return the given result on
successful completion. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCallback(ListenableFutureCallback<? super T> callback)
Registers the given callback to this
ListenableFuture. |
protected void |
done() |
cancel, get, get, isCancelled, isDone, run, runAndReset, set, setExceptionpublic ListenableFutureTask(Callable<T> callable)
ListenableFutureTask that will, upon running, execute the given
Callable.callable - the callable taskpublic ListenableFutureTask(Runnable runnable, T result)
ListenableFutureTask that will, upon running, execute the given
Runnable, and arrange that FutureTask.get() will return the given result on
successful completion.runnable - the runnable taskresult - the result to return on successful completionpublic void addCallback(ListenableFutureCallback<? super T> callback)
ListenableFutureListenableFuture. The callback will
be triggered when this Future is complete or, if it is already complete,
immediately.addCallback in interface ListenableFuture<T>callback - the callback to registerprotected final void done()
done in class FutureTask<T>