Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] The number of threads in the thread pool decreases in real time #1208

Open
magestacks opened this issue Apr 30, 2023 · 3 comments · May be fixed by #1362
Open

[Feature] The number of threads in the thread pool decreases in real time #1208

magestacks opened this issue Apr 30, 2023 · 3 comments · May be fixed by #1362

Comments

@magestacks
Copy link
Member

Demand advice

Please answer these questions before submitting them. Thank you.

Is your function request related to the problem?

NO

Describe the function you want

The number of threads in the thread pool decreases in real time.

Suppose the core and maximum number of threads is 3, n tasks have been run, and the current thread of the thread pool is now 3. And now I've adjusted the number of threads to 1, so when I run the task again, after the task has run, I'll start checking the current thread and the maximum maximum thread, and if it's greater than that, I'll interrupt myself.

I want to do this through the current thread pool plug-in.

@Createsequence

@Createsequence
Copy link
Collaborator

I will try to complete it

@Createsequence Createsequence self-assigned this Apr 30, 2023
Createsequence added a commit to Createsequence/hippo4j that referenced this issue May 2, 2023
…ther the maximum number of threads in the thread pool is exceeded(opengoofy#1208)
Createsequence added a commit to Createsequence/hippo4j that referenced this issue May 28, 2023
…ther the maximum number of threads in the thread pool is exceeded(opengoofy#1208)
Createsequence added a commit to Createsequence/hippo4j that referenced this issue May 28, 2023
…gistering MaximumActiveThreadCountChecker and support regular check of the thread pool registered with the plugin (opengoofy#1208)
Createsequence added a commit to Createsequence/hippo4j that referenced this issue May 28, 2023
…ther the maximum number of threads in the thread pool is exceeded(opengoofy#1208)
Createsequence added a commit to Createsequence/hippo4j that referenced this issue May 28, 2023
…gistering MaximumActiveThreadCountChecker and support regular check of the thread pool registered with the plugin (opengoofy#1208)
Createsequence added a commit to Createsequence/hippo4j that referenced this issue May 29, 2023
…ther the maximum number of threads in the thread pool is exceeded(opengoofy#1208)
@Createsequence
Copy link
Collaborator

Createsequence commented Aug 15, 2023

I have a brand new idea, this plugin may be directly used to allow users to quickly and actively destroy worker threads, not limited to destroying worker threads that exceed the maximum number of threads (in fact, this is also an active destruction scenario).
Simply put, this plugin can satisfy:

When manually/automatically specify a number n according to a certain strategy, if the current number of threads x (which can be the number of worker threads, or just the number of active threads) is greater than n, the plugin will actively and quickly destroy threads by throwing exceptions.

If this idea is feasible, then the subsequent PR will need to be further adjusted.

@magestacks
Copy link
Member Author

The destruction of worker threads should be controlled by allowCoreThreadTimeOut API, Hippo4j I think it is more appropriate to enhance the destruction of non-core threads.

@yanrongzhen yanrongzhen changed the title The number of threads in the thread pool decreases in real time [Feature] The number of threads in the thread pool decreases in real time Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment