Executors.newCachedThreadPool()
//创建一个缓冲池,缓冲池容量大小为Integer.MAX_VALUE
newCachedThreadPool将corePoolSize设置为0,将maximumPoolSize设置为Integer.MAX_VALUE,使用的SynchronousQueue,也就是说来了任务就创建线程运行,当线程空闲超过60秒,就销毁线程。
Executors.newSingleThreadExecutor()
//创建容量为1的缓冲池
newSingleThreadExecutor将corePoolSize和maximumPoolSize都设置为1,也使用的LinkedBlockingQueue。
Executors.newFixedThreadPool(int)
//创建固定容量大小的缓冲池
newFixedThreadPool创建的线程池corePoolSize和maximumPoolSize值是相等的,它使用的LinkedBlockingQueue。