T - the future result type of an asynchronous operation.public class BasicFuture<T> extends Object implements Future<T>, Cancellable
Future interface. BasicFuture
 can be put into a completed state by invoking any of the following methods:
 cancel(), failed(Exception), or completed(Object).| Constructor and Description | 
|---|
| BasicFuture(FutureCallback<T> callback) | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | cancel()Cancels the ongoing operation or process. | 
| boolean | cancel(boolean mayInterruptIfRunning)Attempts to cancel execution of this task. | 
| boolean | completed(T result) | 
| boolean | failed(Exception exception) | 
| T | get()Waits if necessary for the computation to complete, and then retrieves its result. | 
| T | get(long timeout,
   TimeUnit unit)Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if
 available. | 
| boolean | isCancelled()Returns true if this task was cancelled before it completed normally. | 
| boolean | isDone()Returns true if this task completed. | 
public BasicFuture(FutureCallback<T> callback)
public boolean cancel()
Cancellablecancel in interface Cancellabletrue if the operation or process has been cancelled as a result of
 this method call or false if it has already been cancelled or not started.public boolean cancel(boolean mayInterruptIfRunning)
Future
 After this method returns, subsequent calls to Future.isDone() will always return true. Subsequent calls
 to Future.isCancelled() will always return true if this method returned true.
cancel in interface Future<T>mayInterruptIfRunning - true if the thread executing this task should be interrupted; otherwise, in-progress tasks
            are allowed to completepublic boolean completed(T result)
public boolean failed(Exception exception)
public T get() throws InterruptedException, ExecutionException
Futureget in interface Future<T>InterruptedException - if the current thread was interrupted while waitingExecutionException - if the computation threw an exceptionpublic T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
Futureget in interface Future<T>timeout - the maximum time to waitunit - the time unit of the timeout argumentInterruptedException - if the current thread was interrupted while waitingExecutionException - if the computation threw an exceptionTimeoutException - if the wait timed outpublic boolean isCancelled()
FutureisCancelled in interface Future<T>public boolean isDone()
Future