feat: add graceful shutdown hook for task executor#570
Open
muverystrong wants to merge 1 commit intoLianjiaTech:developfrom
Open
feat: add graceful shutdown hook for task executor#570muverystrong wants to merge 1 commit intoLianjiaTech:developfrom
muverystrong wants to merge 1 commit intoLianjiaTech:developfrom
Conversation
Collaborator
|
@claude 检查提交的代码,使用中文回复 |
Collaborator
|
Claude finished @szl97's task —— View job 代码审查结果任务清单:
代码审查反馈我已仔细审查了 ✅ 优点
|
865fe4a to
ff6576d
Compare
fengyizhu
reviewed
Apr 1, 2026
| static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1000, tf); | ||
|
|
||
| static { | ||
| Runtime.getRuntime().addShutdownHook(new Thread(() -> { |
Collaborator
There was a problem hiding this comment.
建议使用Spring的Shutdown钩子:一方面能够在一个地方统一处理优雅停机,另外一方面能够避免 Spring容器实例被销毁导致,正在执行的线程有几率报错。
ff6576d to
9c8a1d9
Compare
9c8a1d9 to
40abbf9
Compare
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
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.
背景:
在关机的时候,很多已经拉取的任务还没执行完。