dubbo
dubbo copied to clipboard
[增加新特性]改进dubbo的shutdown处理过程
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
- [x] I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 所有版本
- Operating System version: 所有系统
- Java version: 所有版本
Steps to reproduce this issue
以下是dubbo注册shutdown钩子相关的类,可以看到:dubbo的shutdown直接挂在了JVM的shutdown钩子上。
- org.apache.dubbo.config.bootstrap.DubboBootstrap#DubboBootstrap
- org.apache.dubbo.config.DubboShutdownHook#register
这种设计导致1个问题:
不能够控制组件的shutdown次序,我希望job组件首先shutdown,dubbo组件随后shutdown,但却做不到。 因为jvm的shutdown钩子是无序的,而spring的shutdown钩子则可以定义执行的先后顺序。
Expected Result
- 如果dubbo单独运行,没有spring环境,则dubbo shutdown直接挂在JVM的shutdown钩子上(维持现状);
- 如果dubbo运行在spring环境下,则关联spring的shutdown钩子,以便控制shutdown的执行顺序(新增特性)。
Actual Result
dubbo当前只支持关联到jvm的shutdown钩子,而不支持关联到spring的shutdown钩子。
Related to #7093.
@klzami Can this issue be closed? If necessary, we can open it again.
fix in #7317
dubbo 3.0.5 版本该问题并没有解决,DubboBeanUtils的registerCommonBeans方法里面的DubboBootstrapApplicationListener也没有注册。所以在dubbo运行在spring环境下,如何关联spring的shutdown的钩子以及控制顺序?有大佬说明一下吗