Creates a {@code FutureTask} that will, upon running, execute the given {@code Callable}.
Creates a {@code FutureTask} that will, upon running, execute the given {@code Runnable}, and arrange that {@code get} will return the given result on successful completion.
Simple linked list nodes to record waiting threads in a Treiber stack. See other classes such as Phaser and SynchronousQueue for more detailed explanation.
Protected method invoked when this task transitions to state {@code isDone} (whether normally or via cancellation). The default implementation does nothing. Subclasses may override this method to invoke completion callbacks or perform bookkeeping. Note that you can query status inside the implementation of this method to determine whether this task has been cancelled.
@throws CancellationException {@inheritDoc}
@throws CancellationException {@inheritDoc}
Sets the result of this future to the given value unless this future has already been set or has been cancelled.
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. This is designed for use with tasks that intrinsically execute more than once.
Sets the result of this future to the given value unless this future has already been set or has been cancelled.
Causes this future to report an {@link ExecutionException} with the given throwable as its cause, unless this future has already been set or has been cancelled.
Returns a string representation of this FutureTask.
A cancellable asynchronous computation. This class provides a base implementation of {@link Future}, with methods to start and cancel a computation, query to see if the computation is complete, and retrieve the result of the computation. The result can only be retrieved when the computation has completed; the {@code get} methods will block if the computation has not yet completed. Once the computation has completed, the computation cannot be restarted or cancelled (unless the computation is invoked using {@link #runAndReset}).
<p>A {@code FutureTask} can be used to wrap a {@link Callable} or {@link Runnable} object. Because {@code FutureTask} implements {@code Runnable}, a {@code FutureTask} can be submitted to an {@link Executor} for execution.
<p>In addition to serving as a standalone class, this class provides {@code protected} functionality that may be useful when creating customized task classes.
@author Doug Lea @param (V) The result type returned by this FutureTask's {@code get} methods