通俗易懂的JUC源码剖析-FutureTask

前言

实现原理

先来看类结构

public class FutureTask implements RunnableFuture {
}
public interface RunnableFuture extends Runnable, Future {
}
public interface Future {
    // 
    boolean cancel(boolean mayInterruptIfRunning);
    // 
    boolean isCancelled();
    // 
    boolean isDone();
    // 
    V get() throws InterruptedException, ExecutionException;
    // 
    V get(long timeout, TimeUnit unit)
    throws InterruptedException, ExecutionException, TimeoutException;
}

后续再分析叭,今天先观摩其他人的文章。

你可能感兴趣的:(java)