线程池原理(讲的非常棒)

https://blog.csdn.net/gol_phing/article/details/49032055

一.Java中的ThreadPoolExecutor类

  java.uitl.concurrent.ThreadPoolExecutor类是线程池中最核心的一个类,因此如果要透彻地了解Java中的线程池,必须先了解这个类。下面我们来看一下ThreadPoolExecutor类的具体实现源码。

  在ThreadPoolExecutor类中提供了四个构造方法:

publicclassThreadPoolExecutor extends AbstractExecutorService {

    publicThreadPoolExecutor(intcorePoolSize,intmaximumPoolSize,longkeepAliveTime,TimeUnit unit,

            BlockingQueue workQueue);

    publicThreadPoolExecutor(intcorePoolSize,intmaximumPoolSize,longkeepAliveTime,TimeUnit unit,

            BlockingQueue workQueue,ThreadFactory threadFactory);

    publicThreadPoolExecutor(intcorePoolSize,intmaximumPoolSize,longkeepAliveTime,TimeUnit unit,

            BlockingQueue workQueue,RejectedExecutionHandler handler);

    publicThreadPoolExecutor(intcorePoolSize,intmaximumPoolSize,longkeepAliveTime,TimeUnit unit,

        BlockingQueue workQueue,ThreadFactory threadFactory,RejectedExecutionHandler handler);

    ...

}

你可能感兴趣的:(线程池原理(讲的非常棒))