线程池
// 无限制大小
ExecutorService.newThreadCashPool();
// 固定大小
ExecutorService.newFixedThreadPool(n)
// 单个线程的线程池
ExecutorService.newSingleThreadExecutor()
1.coreSize
小于coreSize 直接获取线程
2.maxNumSize
大于coreSize 且小于maxNumSize 放入队列,队列满了之后创建获取线程超过maxNumSize之后就只直接执行拒绝策略
3.keepalivetime
4.unit
5.workqueue
6.threadFactory 直接抛弃
7.拒绝策略 抛出异常,直接拒绝,。。。
threadLocal
threadLocal 当前线程内可访问
threadLocalMap.put(this.currentThread(),value);