乐趣区

关于java:通俗易懂的JUC源码剖析FutureTask

前言

实现原理

先来看类构造

public class FutureTask<V> implements RunnableFuture<V> {}
public interface RunnableFuture<V> extends Runnable, Future<V> {}
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;
}

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

退出移动版