-
Notifications
You must be signed in to change notification settings - Fork 46.1k
Update java-concurrent-questions-03.md #2773
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScheduledThreadPool 和 SingleThreadScheduledExecutor 也是可以创建任意数量的线程,不是因为DelayedWorkQueue,而且 private static final int INITIAL_CAPACITY = 16; private RunnableScheduledFuture<?>[] queue = new RunnableScheduledFuture<?>[INITIAL_CAPACITY];DelayedWorkQueue的默认容量是16
Author
hay211
commented
Jan 13, 2026
Owner
Snailclimb
commented
Jan 13, 2026
虽然maximumPoolSize设置得很大,但因为队列无界,永远触发无法创建非核心线程的逻辑。DelayedWorkQueue的最初容量虽小,但却是无界扩容的。
Author
hay211
commented
Jan 14, 2026
好的,明白了,感谢Guide的回答
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
ScheduledThreadPool 和 SingleThreadScheduledExecutor 也是可以创建任意数量的线程,不是因为DelayedWorkQueue,而且 默认容量是16