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
网友评论