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