dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[增加新特性]改进dubbo的shutdown处理过程

Open klzami opened this issue 5 years ago • 4 comments

  • [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钩子上。

  1. org.apache.dubbo.config.bootstrap.DubboBootstrap#DubboBootstrap
  2. org.apache.dubbo.config.DubboShutdownHook#register

这种设计导致1个问题:

不能够控制组件的shutdown次序,我希望job组件首先shutdown,dubbo组件随后shutdown,但却做不到。 因为jvm的shutdown钩子是无序的,而spring的shutdown钩子则可以定义执行的先后顺序。

Expected Result

  1. 如果dubbo单独运行,没有spring环境,则dubbo shutdown直接挂在JVM的shutdown钩子上(维持现状);
  2. 如果dubbo运行在spring环境下,则关联spring的shutdown钩子,以便控制shutdown的执行顺序(新增特性)。

Actual Result

dubbo当前只支持关联到jvm的shutdown钩子,而不支持关联到spring的shutdown钩子。

klzami avatar May 11 '21 03:05 klzami

Related to #7093.

xiaoheng1 avatar May 11 '21 03:05 xiaoheng1

@klzami Can this issue be closed? If necessary, we can open it again.

pinxiong avatar May 15 '21 04:05 pinxiong

fix in #7317

AlbumenJ avatar May 16 '21 12:05 AlbumenJ

dubbo 3.0.5 版本该问题并没有解决,DubboBeanUtils的registerCommonBeans方法里面的DubboBootstrapApplicationListener也没有注册。所以在dubbo运行在spring环境下,如何关联spring的shutdown的钩子以及控制顺序?有大佬说明一下吗

leimbag avatar Apr 07 '22 03:04 leimbag