ThreadPoolExecutor pool = new ThreadPoolExecutor(
3,//核心线程数量
6,//最大线程
60,//空闲线程存活时间
TimeUnit.SECONDS,//时间单位
new ArrayBlockingQueue<>(3),//任务队列
Executors.defaultThreadFactory(),//创建线程工厂
new ThreadPoolExecutor.AbortPolicy(),//任务拒绝策略
);

该段代码配置了一个ThreadPoolExecutor,设置了核心线程数为3,最大线程数为6,空闲线程存活时间为60秒,任务队列大小为3,使用默认线程工厂,并在队列满时采用AbortPolicy拒绝策略。
1167





