Reprint: http://www.cnblogs.com/dolphin0520/p/3932921.html
I. Threadpoolexecutor class in Java
The Java.util.concurrent.ThreadPoolExecutor class is the most core class in the thread pool, so if you want to get a thorough understanding of the Java Center pool, you must first understand this class. Below see Threadpoolexecutor Class of concrete realization source code:
Four construction methods are provided in the Threadpoolexecutor class:
public class Threadpoolexecutor extends Abstractexecutorservice { ..... public threadpoolexecutor (int corepoolsize,int maximumpoolsize,long keepalivetime,timeunit unit, BlockingQueue<Runnable> workQueue); public threadpoolexecutor (int corepoolsize,int maximumpoolsize,long KeepAliveTime,TimeUnit Unit, blockingqueue<runnable> Workqueue,threadfactory threadfactory); public threadpoolexecutor (int corePoolSize, int Maximumpoolsize,long Keepalivetime,timeunit unit, BlockingQueue<Runnable> Workqueue,rejectedexecutionhandler Handler); public threadpoolexecutor (int corepoolsize,int maximumpoolsize,long keepalivetime,timeunit unit, &nBsp; blockingqueue<runnable> Workqueue,threadfactory ThreadFactory, Rejectedexecutionhandler handler); ...}
As you can tell from the code above, Threadpoolexecutor inherits the Abstractexecutorservice class and provides four constructors, in fact, by observing the concrete implementation of each constructor's source code, The first three constructors are found to be initialized by invoking the fourth constructor.
Java Concurrency Programming (4)--usage of thread pool