Java线程池使用

1.构造函数 

public ThreadPoolExecutor(int corePoolSize,
                  int maximumPoolSize,
                  long keepAliveTime,
                  TimeUnit unit,
                  BlockingQueue<Runnable> workQueue,
                  ThreadFactory threadFactory)

corePoolSize -

maximumPoolSize - 线程池中允许的最大线程数

keepAliveTime - when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.

unit - the time unit for the keepAliveTime argument

workQueue - 工作队列,当corePoolSize达到最大值时,提交的线程保存在工作队列

Factory - 创建线程的工程

posted @ 2017-01-13 12:19  zjxbeta  阅读(133)  评论(0)    收藏  举报