V - the type returnedpublic class FutureForwardingTask<V> extends AbstractTask<V>
ListenableFuture.
State#SCHEDULED is never returned because it is not possible
to test whether the future has "started," so State#RUNNING is
returned in its place.
Use create(ListenableFuture, String, Object) to create a new
instance.
Task.State| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Runnable listener,
Executor executor) |
boolean |
cancel(boolean mayInterruptIfRunning) |
static <V> FutureForwardingTask<V> |
create(com.google.common.util.concurrent.ListenableFuture<V> future,
String name,
Object owner)
Create a new instance.
|
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
Progress |
getProgress()
Get the current percentage of completion.
|
Task.State |
getState()
Get the state of the task.
|
boolean |
isCancelled() |
boolean |
isDone() |
getCreationDate, getName, getOwner, getUniqueIdpublic boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled in interface Future<V>isCancelled in class com.google.common.util.concurrent.AbstractFuture<V>public boolean isDone()
public V get() throws InterruptedException, ExecutionException
get in interface Future<V>get in class com.google.common.util.concurrent.AbstractFuture<V>InterruptedExceptionExecutionExceptionpublic V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<V>get in class com.google.common.util.concurrent.AbstractFuture<V>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic Task.State getState()
Taskpublic Progress getProgress()
ProgressObservablepublic static <V> FutureForwardingTask<V> create(com.google.common.util.concurrent.ListenableFuture<V> future, String name, @Nullable Object owner)
V - the type returned by the futurefuture - the futurename - the name of the taskowner - the owner of the task, or nullCopyright © 2015. All Rights Reserved.