Future 详解

Overview

1
2
3
4
5
6
public interface Future<V> {
boolean cancel(boolean mayInterruptIfRunning);
boolean isCancelled();
boolean isDone();
V get() throws InterruptedException, ExecutionException;
V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException;

Future 是一个还算是见的接口,我们看看究竟是怎么实现的。它有多个实现类,我们看下最为重要的

java.util.concurrent.FutureTask

Read More