码迷,mamicode.com
首页 > 其他好文 > 详细

threadpool

时间:2018-06-06 22:13:55      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:处理   tst   lex   integer   pool   队列   的区别   net   资源   

Executors和ThreadPoolExecutor两者的区别和联系

jdk中文文档 https://blog.fondme.cn/apidoc/jdk-1.8-google/
https://blog.csdn.net/qq_25806863/article/details/71126867
https://blog.csdn.net/hayre/article/details/53291712

4. 【强制】线程池不允许使用 Executors 去创建,而是通过 ThreadPoolExecutor 的方式,这样
的处理方式让写的同学更加明确线程池的运行规则,规避资源耗尽的风险。
说明: Executors 返回的线程池对象的弊端如下:
1FixedThreadPool SingleThreadPool:
允许的请求队列长度为 Integer.MAX_VALUE,可能会堆积大量的请求,从而导致 OOM
2CachedThreadPool ScheduledThreadPool:
允许的创建线程数量为 Integer.MAX_VALUE, 可能会创建大量的线程,从而导致 OOM

threadpool

标签:处理   tst   lex   integer   pool   队列   的区别   net   资源   

原文地址:https://www.cnblogs.com/codeLei/p/9146741.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!