Thread Pool implementation

Source: Internet
Author: User

A thread pool has been implemented in JAVA recently, mainly to complete a time-consuming task, which is described as follows:
In the thread, the task to be implemented may be a task that needs to run for more than 10 minutes, and several threads will be opened in each task. Considering the performance and stability of the server, control the total number of tasks.
The task is generated and started to run on the page. Considering the user's usage perception, you can display in real time how many tasks are running in the current background on the foreground. if the task is full, you can choose whether to add it to the execution waiting queue or discard the current task.
Therefore, this thread pool summarizes the following functions:
1. Execution queue Cache
2. task execution
3. you can obtain the current execution status, including the number of ongoing executions, the number of executions that can be added, the number of pending executions, and the execution percentage of each task, you can better decide whether to add the executable to the waiting queue when the number of executions is no longer available.
 
Do you have any suggestions for implementing such a thread pool?
 
 
 
This article is from "never stop !!!" Blog

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.