线程池 Executor框架

image.png
ExecutorService pool=Executors.newFixedThreadPool(10);

newFixedThreadPool的底层源码是

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

newCachedsThreadPool()的底层源码是

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

newSingleThreadExecutor()的底层源码是

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

你可能感兴趣的:(线程池 Executor框架)