java.util.concurrent源码学习系列--Executor

Executor的系列类图如下:这一些了类或接口都是和任务提交和执行相关的。

 


java.util.concurrent.Executor接口:

 /* @since 1.5
 * @author Doug Lea
 */
public interface Executor {

    /**
     * Executes the given command at some time in the future.  The command
     * may execute in a new thread, in a pooled thread, or in the calling
     * thread, at the discretion of the <tt>Executor</tt> implementation.
     *会在将来某个时刻去执行任务,也就是所谓的异步执行
     *
     * @param command the runnable task
     * @throws RejectedExecutionException if this task cannot be
     * accepted for execution.
     * @throws NullPointerException if command is null
     */
    void execute(Runnable command);
}

java.util.concurrent.ExecutorService接口,该接口定义的方法如下:



 这些方法一部分在AbstractExecutorService提供了默认的实现,一部分延迟到ThreadPoolExecutor里实现。

java.util.concurrent.AbstractExecutorService抽象类:

java.util.concurrent.ThreadPoolExecutor类:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值