[JUC-4]ThreadPoolExecutor源码分析
生活随笔
收集整理的這篇文章主要介紹了
[JUC-4]ThreadPoolExecutor源码分析
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?相關(guān)博文:
https://segmentfault.com/a/1190000008693801
https://www.jianshu.com/p/fa1eac9710c8
//構(gòu)造器1 public ThreadPoolExecutor(int corePoolSize,int maximumPoolSize,long keepAliveTime,TimeUnit unit,BlockingQueue<Runnable> workQueue) {this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,Executors.defaultThreadFactory(), defaultHandler); } //構(gòu)造器2 public ThreadPoolExecutor(int corePoolSize,int maximumPoolSize,long keepAliveTime,TimeUnit unit,BlockingQueue<Runnable> workQueue,RejectedExecutionHandler handler) {this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,Executors.defaultThreadFactory(), handler); } //構(gòu)造器3 public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize,long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler);構(gòu)造器參數(shù)詳解如下: corePoolSize:核心線程的數(shù)量; maximumPoolSize:最大的線程數(shù)量; keepAliveTime:當(dāng)線程數(shù)量大于corePoolSize時(shí),多余的線程的最大存活時(shí)間(如果空閑的話); unit:keepAliveTime的單位; workQueue:提交但尚未被執(zhí)行的任務(wù)隊(duì)列; threadFactory:線程工廠,用于創(chuàng)建線程; handler:拒絕策略,當(dāng)任務(wù)提交不能被執(zhí)行時(shí)的補(bǔ)救措施;?
線程池大小設(shè)置
https://www.cnblogs.com/lengender-12/p/6869554.html
http://ifeve.com/how-to-calculate-threadpool-size/
轉(zhuǎn)載于:https://www.cnblogs.com/Joy-Hu/p/10677447.html
總結(jié)
以上是生活随笔為你收集整理的[JUC-4]ThreadPoolExecutor源码分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MATLAB中图像处理的一些简单函数
- 下一篇: Win10电脑开机提示“no boota