美文网首页
线程池 Executor框架

线程池 Executor框架

作者: 小爪哇海 | 来源:发表于2018-10-30 23:10 被阅读0次
image.png
ExecutorService pool=Executors.newFixedThreadPool(10);

newFixedThreadPool的底层源码是

new ThreadPoolExecutor(nThreads,nThreads,0L,TimeUnit.
MILLISECONDS,new LinkedBlockingQueue<Runnable>());

newCachedsThreadPool()的底层源码是

new ThreadPoolExecutor(0,Integer.MAX_VALUE,60L,TimeUnit.SECONDS,new SynchronusQueue<Runnable>());

newSingleThreadExecutor()的底层源码是

new FinalizableDelegatedExecutorService(new ThreadPoolExecutor(1,1,0L,TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>()));
image.png image.png

相关文章

网友评论

      本文标题:线程池 Executor框架

      本文链接:https://www.haomeiwen.com/subject/dvbntqtx.html