构造方法:
ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
corePoolSize:核心线程数。不会被回收
maximumPoolSize:最大线程数。
keepAliveTime:非核心线程在workqueue中的排队时间,超过此时间会被回收。
unit:keepAliveTime的时间单位
threadFactory:
workQueue:常用的:SynchronousQueue,LinkedBlockingQueue,还有ArrayBlockingQueue,DelayQueue,PriorityBlockingQueue.
线程池ThreadPoolExecutor
最新推荐文章于 2020-04-26 14:48:20 发布