Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Java: Add java/javautilconcurrentscheduledthreadpoolexecutor query for zero thread pool size #19844

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

Merged
merged 3 commits into from
Jun 26, 2025

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Jun 23, 2025

This pull request introduces a new query to identify potential issues with setting the corePoolSize of ScheduledThreadPoolExecutor to zero, which may lead to unintended behavior and programmer error. The changes include adding the query logic, documentation, test cases, and integration into the query suite.

MRVA top 100 only reports 4 alerts. I checked autofix on 3 of these. Two autofix suggestions completely removed the executor.setCorePoolSize(0) calls, the third one changed the 0 value to Schedulers.DEFAULT_POOL_SIZE, which is the value used in setMaximumPoolSize.

@tamasvajk tamasvajk force-pushed the tamasvajk/threadpoolexecutor branch from e2b0faa to c6a4221 Compare June 23, 2025 10:11
@tamasvajk tamasvajk force-pushed the tamasvajk/threadpoolexecutor branch from c6a4221 to 60e726b Compare June 23, 2025 10:52
@tamasvajk tamasvajk marked this pull request as ready for review June 24, 2025 10:59
@tamasvajk tamasvajk requested a review from a team as a code owner June 24, 2025 10:59
@tamasvajk tamasvajk added the no-change-note-required This PR does not need a change note label Jun 24, 2025
michaelnebel
michaelnebel previously approved these changes Jun 25, 2025
Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tamasvajk tamasvajk merged commit ae36f94 into github:main Jun 26, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Java no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants