了解了线程池的基本参数
那么,啥玩意儿又叫任务队列呢?
任务还是蛮抽象的哈
看下源码:
public ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory) {
this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
threadFactory, defaultHandler);
}
其实就是这段构造方法,
任务队列就是一个
java.util.concurrent.BlockingQueue
泛型是Runnable
其实也就是线程池提交任务的时候,提交的那玩意儿