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

Wait for all close method to be completed before shutdown the ExecutorService #469

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

intechsen
Copy link

TomcatWebServer等优雅下线异步逻辑,可能dynamictp线程池关闭后,但web容器还存在未释放的线程需要用到线程池,就会由于dynamictp已关闭而报错。
这里设置Phase-1,降低close调用的优先级,并且把完全shutdown线程池的时机,放到所有对象close后的销毁bean时再关闭线程池。

liusen and others added 5 commits August 24, 2024 23:31
…d. Such as after calling gracefulShutdown in the close method of TomcatWebServer
…he thread. Such as after calling gracefulShutdown in the close method of TomcatWebServer"

This reverts commit 2cb17fc.
…d. Such as after calling gracefulShutdown in the close method of TomcatWebServer. And reduce phase Close later
public void destroy() throws Exception {
if (this.running.compareAndSet(true, false)) {
shutdownInternal();
DtpRegistry.getAllExecutors().forEach((k, v) -> DtpLifecycleSupport.destroy(v));
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以设置awaitTerminationSeconds,延长等待时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants