Four types of thread pools provided by executors

Source: Internet
Author: User

1, Newcahchethreadpool:

Thread pool can be created as needed, if the thread is not available, when a new task comes, create a new thread to add to the line constructor. Resources are reclaimed for threads that are not used in the thread pool for more than 60s

2, Newsigletreadpool:

Create a single thread pool, that is, only one of the threads in this thread is working, the task is serial, and if the running thread ends abnormally, there will be a new thread pulling up, the thread pool will ensure that all tasks are executed in the order in which they are submitted.

3, Newfiexdtreadpool:

Create a fixed-size thread pool, create a thread pool each time a task is committed, and then reach the maximum number of threads, the maximum thread pool will remain the same, and if a thread ends up with an exception, a new thread will be created.

4, Newscheduledthreadpool:

Creates a thread pool of unlimited size that supports timing and the need to perform tasks periodically.

Four types of thread pools provided by executors

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.