Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
hay211 wants to merge 1 commit into Snailclimb:main from hay211:patch-1
Closed

Conversation

@hay211
Copy link

@hay211 hay211 commented Jan 13, 2026
edited
Loading

ScheduledThreadPool 和 SingleThreadScheduledExecutor 也是可以创建任意数量的线程,不是因为DelayedWorkQueue,而且 默认容量是16

ScheduledThreadPool 和 SingleThreadScheduledExecutor 也是可以创建任意数量的线程,不是因为DelayedWorkQueue,而且 private static final int INITIAL_CAPACITY = 16;
 private RunnableScheduledFuture<?>[] queue =
 new RunnableScheduledFuture<?>[INITIAL_CAPACITY];DelayedWorkQueue的默认容量是16
Copy link
Author

hay211 commented Jan 13, 2026

Copy link
Owner

image

虽然maximumPoolSize设置得很大,但因为队列无界,永远触发无法创建非核心线程的逻辑。DelayedWorkQueue的最初容量虽小,但却是无界扩容的。

@hay211 hay211 deleted the patch-1 branch January 14, 2026 01:51
Copy link
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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /