R - The type of the result.E - The type of any ExecutionException cause.Runnable, Future<R>, RunnableFuture<R>public abstract class RunnableFutureTask<R,E extends Exception> extends Object implements RunnableFuture<R>
RunnableFuture that supports additional uninterruptible operations to query whether
execution has started and finished.| Modifier | Constructor | Description |
|---|---|---|
protected |
RunnableFutureTask() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
blockUntilFinished() |
Blocks until the task has finished, or has been canceled without having been started.
|
void |
blockUntilStarted() |
Blocks until the task has started, or has been canceled without having been started.
|
boolean |
cancel(boolean interruptIfRunning) |
|
protected void |
cancelWork() |
Cancels any work being done by
doWork(). |
protected abstract R |
doWork() |
Performs the work or computation.
|
R |
get() |
|
R |
get(long timeout,
TimeUnit unit) |
|
boolean |
isCancelled() |
|
boolean |
isDone() |
|
void |
run() |
public final void blockUntilStarted()
public final void blockUntilFinished()
public final R get() throws ExecutionException, InterruptedException
get in interface Future<R>ExecutionExceptionInterruptedExceptionpublic final R get(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException
get in interface Future<R>ExecutionExceptionInterruptedExceptionTimeoutExceptionpublic final boolean cancel(boolean interruptIfRunning)
public final boolean isCancelled()
isCancelled in interface Future<R>public final void run()
run in interface Runnablerun in interface RunnableFuture<R>protected void cancelWork()