JAVA Simple thread pool differences

Source: Internet
Author: User

Create a thread pool:

  

A few thread pools that are more commonly used

1 "Newcachedthreadpool

This is a pool of cache threads. Create a thread pool that will reclaim threads if there are idle threads present, and if the thread is not enough, create a new thread

2 "Newfixedthreadpool

Initializing a fixed-length thread pool, the maximum length of threads can be controlled, and the longest threads will wait.

3 "Newscheduledthreadpool

can support the task scheduling of the thread, support cycle and timing tasks, can be said to the task and tasktime optimization, for the task execution time is too long or the simultaneous execution of multiple tasks, etc. is more appropriate.

4 "Newsinglethreadexecutor

This is a singleton thread pool, and all tasks are executed in the order set (Fifo,lilo).

JAVA Simple thread pool differences

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.