java多线程---------java.util.concurrent并发包----------ThreadPoolExecutor
Posted 让我们只争朝夕,不负韶华,共同迎接2020年的到来
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java多线程---------java.util.concurrent并发包----------ThreadPoolExecutor相关的知识,希望对你有一定的参考价值。
ThreadPoolExecutor线程池
一、三个构造方法
ThreadPoolExecutor(int corePoolSize,int MaxmumPoolSize,long KeepAliveTime,,TimeUnit unit,BolokingQueue<Runnable> workQueue)
ThreadPoolExecutor(int corePoolSize,int MaxmumPoolSize,long KeepAliveTime,,TimeUnit unit,BolokingQueue<Runnable> workQueue,RejectExceptionHandler handler)
ThreadPoolExecutor(int corePoolSize,int MaxmumPoolSize,long KeepAliveTime,,TimeUnit unit,BolokingQueue<Runnable> workQueue,ThreadFactory threadFactory)
ThreadPoolExecutor(int corePoolSize,int MaxmumPoolSize,long KeepAliveTime,,TimeUnit unit,BolokingQueue<Runnable> workQueue,ThreadFactory threadFactory,RejecExceptiontHandler handler,)
标注
1、CorePoolSize 线程池的基本大小
2、MaxmunPoolSize 线程池最大数量
3、KeepAliveTime 线程活动保持时间
4、BlokingQueue 任务队列 (ArrayBlokingQueue LinkedBlokingQueue synchronousQueue PriorityBlokingQueue)
5、RejectExceptionHandler 饱和策略 (AbortPlicy CallerRunsPolicy DiscardOldestPolicy DiscardPolicy)
6、ThreadFactory
以上是关于java多线程---------java.util.concurrent并发包----------ThreadPoolExecutor的主要内容,如果未能解决你的问题,请参考以下文章
Java多线程工具包java.util.concurrent---ExecutorService
java多线程---------java.util.concurrent并发包----------ThreadPoolExecutor
Java多线程工具包java.util.concurrent---CyclicBarrier