线程池类型 | corePoolSize | 队列 |
---|---|---|
newCachedThreadPool | 0 | SynchronousQueue |
newSingleThreadExecutor | 1 | LinkedBlockingQueue |
newFixedThreadPool | nThreads | LinkedBlockingQueue |
newScheduledThreadPool | 1 | DelayedWorkQueue |
newSingleThreadScheduledExecutor | 1 | DelayedWorkQueue |
拒绝策略 |
---|
默认 AbortPolicy 拒绝 |
DiscardPolicy 忽略 |
CallerRuns 线程自己执行 |
DiscardOldest 丢弃最老的 |