package java.util.concurrent;
/**
* A Future represents the result of an asynchronous computation.
*/
public interface Future<V> {
/**
* Attempts to cancel execution of this task.
*/
boolean cancel(boolean mayInterruptIfRunning);
/**
* Returns true if this task was cancelled before it completed normally.
*/
boolean isCancelled();
/**
* Returns true if this task completed.
*/
boolean isDone();
/**
* Waits if necessary for the computation to complete, and then
* retrieves its result.
*/
V get() throws InterruptedException, ExecutionException;
/**
* Waits if necessary for at most the given time for the computation
* to complete, and then retrieves its result, if available.
*
* @param timeout the maximum time to wait
* @param unit the time unit of the timeout argument
*/
V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException;
}
原文:https://www.cnblogs.com/feiqiangsheng/p/15237458.html