Environment
- Dubbo version: 2.7.0
- Operating System version: mac
- Java version: 1.8
org.apache.dubbo.config.AbstractConfig:
static {
// this is only for compatibility
Runtime.getRuntime().addShutdownHook(DubboShutdownHook.getDubboShutdownHook());
}
The jvm hook is registered by default. When the user uses spring, the default hook is not removed. It was the earliest cause of this shutdown graceful, mainly due to this reason. Please note:
Spring does not register hooks by default, but users may register themselves, spring-boot will also register hooks by default.
org.apache.dubbo.config.spring.extension.SpringExtensionFactory.ShutdownHookListener:
private static class ShutdownHookListener implements ApplicationListener {
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextClosedEvent) {
// we call it anyway since dubbo shutdown hook make sure its destroyAll() is re-entrant.
// pls. note we should not remove dubbo shutdown hook when spring framework is present, this is because
// its shutdown hook may not be installed.
DubboShutdownHook shutdownHook = DubboShutdownHook.getDubboShutdownHook();
shutdownHook.destroyAll();
}
}
}
Environment
org.apache.dubbo.config.AbstractConfig:The jvm hook is registered by default. When the user uses spring, the default hook is not removed. It was the earliest cause of this shutdown graceful, mainly due to this reason. Please note:
Spring does not register hooks by default, but users may register themselves, spring-boot will also register hooks by default.
org.apache.dubbo.config.spring.extension.SpringExtensionFactory.ShutdownHookListener: