From 85b03bca5601c416587677c984f8a76cc0af02ad Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Wed, 16 Aug 2023 15:15:13 +0800 Subject: [PATCH] Support keep running on spring closed with properties (#12912) * Support keep running on spring closed with properties * name --- .../java/org/apache/dubbo/rpc/model/ModelConstants.java | 2 ++ .../spring/context/DubboDeployApplicationListener.java | 4 ++++ .../org/apache/dubbo/qos/command/impl/BaseOffline.java | 8 +++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModelConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModelConstants.java index 447c798c5f..c25031da51 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModelConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModelConstants.java @@ -24,4 +24,6 @@ public interface ModelConstants { * Keep Dubbo running when spring is stopped */ String KEEP_RUNNING_ON_SPRING_CLOSED = "keepRunningOnSpringClosed"; + + String KEEP_RUNNING_ON_SPRING_CLOSED_KEY = "dubbo.module.keepRunningOnSpringClosed"; } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java index 3f32748e0b..73c07c5b29 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java @@ -16,6 +16,7 @@ */ package org.apache.dubbo.config.spring.context; +import org.apache.dubbo.common.config.ConfigurationUtils; import org.apache.dubbo.common.deploy.DeployListenerAdapter; import org.apache.dubbo.common.deploy.DeployState; import org.apache.dubbo.common.deploy.ModuleDeployer; @@ -169,6 +170,9 @@ public class DubboDeployApplicationListener implements ApplicationListener> futures = new LinkedList<>(); Collection providerModelList = serviceRepository.allProviderModels(); @@ -92,6 +92,8 @@ public class BaseOffline implements BaseCommand { } } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); + } finally { + executorService.shutdown(); } return hasService;