V
- the type returnedpublic class FutureForwardingTask<V> extends AbstractTask<V>
ListenableFuture
.
Task.State.SCHEDULED
is never returned because it is not possible
to test whether the future has "started," so Task.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(java.lang.Runnable listener,
java.util.concurrent.Executor executor) |
boolean |
cancel(boolean mayInterruptIfRunning) |
static <V> FutureForwardingTask<V> |
create(com.google.common.util.concurrent.ListenableFuture<V> future,
java.lang.String name,
java.lang.Object owner)
Create a new instance.
|
V |
get() |
V |
get(long timeout,
java.util.concurrent.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, getUniqueId
public void addListener(java.lang.Runnable listener, java.util.concurrent.Executor executor)
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
public boolean isDone()
public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
public V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
public Task.State getState()
Task
public Progress getProgress()
ProgressObservable
public static <V> FutureForwardingTask<V> create(com.google.common.util.concurrent.ListenableFuture<V> future, java.lang.String name, @Nullable java.lang.Object owner)
V
- the type returned by the futurefuture
- the futurename
- the name of the taskowner
- the owner of the task, or null