A FutureTask can be used to wrap a Callable or Runnable object. Because FutureTask implements Runnable, a FutureTask can be submitted to an Executor for execution.
In addition to serving as a standalone class, this class provides protected functionality that may be useful when creating customized task classes.
| Constructor Summary |
|---|
|
Creates a FutureTask that will, upon running, execute the given Callable. |
|
Creates a FutureTask that will, upon running, execute the given Runnable, and arrange that get will return the given result on successful completion. |
| Method Summary | |
|---|---|
| boolean |
No description provided. |
| protected void |
Protected method invoked when this task transitions to state isDone (whether normally or via cancellation). |
| V |
No description provided. |
| V |
No description provided. |
| boolean |
No description provided. |
| boolean |
No description provided. |
| void |
Sets this Future to the result of its computation unless it has been cancelled. |
| protected boolean |
Executes the computation without setting its result, and then resets this Future to initial state, failing to do so if the computation encounters an exception or is cancelled. |
| protected void |
Sets the result of this Future to the given value unless this future has already been set or has been cancelled. |
| protected void |
Causes this future to report an ExecutionException with the given throwable as its cause, unless this Future has already been set or has been cancelled. |
| Methods inherited from java.langObject |
|---|
public
boolean
cancel
(
boolean
mayInterruptIfRunning
)
protected
void
done
(
)
public
boolean
isCancelled
(
)
public
boolean
isDone
(
)
public
void
run
(
)
protected
boolean
runAndReset
(
)
protected
void
set
(
V
v
)