这是进行异步计算的接口
public interface Future<V>
boolean cancel(boolean mayInterruptIfRunning);
这个方法是取消执行这个异步任务的方法 参数为true代表任务可以被打断
boolean isCancelled();
这个方法是判断这个任务是否被取消的方法
boolean isDone();
这个方法是判断这个任务是否完成的方法
V get() throws InterruptedException, ExecutionException;
这个方法是获取执行结果的方法
V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException;
这个方法是根据截止时间获取执行结果的方法
public interface RunnableFuture<V> extends Runnable, Future<V> {
void run();
}
RunnableFuture接口继承自Runnable和Future 就一个run方法