线程池 Executor框架
2018-10-30 本文已影响0人
小爪哇海

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>()));

