![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线程池相关
文章平均质量分 64
quzhem
这个作者很懒,什么都没留下…
展开
-
ThreadPoolExecutor代码总结
简介线程池使用方法corePoolSize:核心线程数maximumPoolSize:最大线程数keepAliveTime:当总线程数大于核心线程数时,多余的空闲线程的最长停留时间unit:对应上面的时间单位workQueue:任务等待队列,超出核心线程数时,新任务会加入这个队列,常用的有ArrayBlockingQueue、LinkedBlockingQueue和SynchronousQueue(无界队列)等handler:饱和策略,超出最大线程数和队列都无法存放时的饱和策原创 2021-03-10 17:48:06 · 158 阅读 · 1 评论 -
CountDownLatch源码分析
A synchronization aid that allows one or more threads to wait untila set of operations being performed in other threads completes.主要有await()、countDown()这两个使用方法1、await(),底层调用AbstractQueuedSynchronizer的方法 /** * Acquires in shared mode, abor...原创 2021-03-09 11:32:12 · 56 阅读 · 0 评论