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
get method will block if the computation has not yet completed. Once the computation has completed, the computation cannot be restarted or cancelled.
A FutureTask can be used to wrap a {@link Callable} or{@link java.lang.Runnable} object. Because FutureTaskimplements Runnable, a FutureTask can be submitted to an {@link 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.
@since 1.5
@author Doug Lea