Java Concurrency Programming (4)--usage of thread pool

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.