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

前言

实现原理

先来看类结构code

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

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

相关文章
相关标签/搜索