RunnableFutureTask
@UnstableApi
public abstract class RunnableFutureTask<R, E extends Exception> implements RunnableFuture
A RunnableFuture that supports additional uninterruptible operations to query whether execution has started and finished.
| Parameters | |
|---|---|
<R> |
The type of the result. |
<E extends Exception> |
The type of any |
Summary
Protected constructors |
|---|
Public methods |
|
|---|---|
final void |
Blocks until the task has finished, or has been canceled without having been started. |
final void |
Blocks until the task has started, or has been canceled without having been started. |
final boolean |
cancel(boolean interruptIfRunning) |
final R |
|
final R |
@UnknownNull |
final boolean |
|
final boolean |
isDone() |
final void |
run() |
Protected methods |
|
|---|---|
void |
Cancels any work being done by |
abstract R |
Performs the work or computation. |
Inherited methods |
|---|
Protected constructors
Public methods
blockUntilFinished
public final void blockUntilFinished()
Blocks until the task has finished, or has been canceled without having been started.
blockUntilStarted
public final void blockUntilStarted()
Blocks until the task has started, or has been canceled without having been started.
Protected methods
cancelWork
protected void cancelWork()
Cancels any work being done by doWork. If doWork is currently executing then the thread on which it's executing may be interrupted immediately after this method returns.
The default implementation does nothing.
doWork
@UnknownNull
protected abstract R doWork()
Performs the work or computation.
| Returns | |
|---|---|
R |
The computed result. |
| Throws | |
|---|---|
E |
If an error occurred. |