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

7次阅读

共计 405 个字符,预计需要花费 2 分钟才能阅读完成。

前言

实现原理

先来看类构造

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;
}

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

正文完
 0