You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/09/30 02:16:50 UTC
[dubbo] branch master updated: [master] Fix #8240, on branch master,
when provider and consumer stop cause NPE (#8927)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 1cf911d [master] Fix #8240, on branch master, when provider and consumer stop cause NPE (#8927)
1cf911d is described below
commit 1cf911d27dc1d3b5e373a749c33641aafeac53f1
Author: Wang Chengming <63...@qq.com>
AuthorDate: Thu Sep 30 10:16:41 2021 +0800
[master] Fix #8240, on branch master, when provider and consumer stop cause NPE (#8927)
* fix #8240: on branch master, when provider and consumer stop cause NPE
* fix #8240: on branch master, when provider and consumer stop cause NPE
* fix #8240: on branch master, when provider and consumer stop cause NPE
* fix #8240: on branch master, when provider and consumer stop cause NPE
* fix #8240: on branch master, when provider and consumer stop cause NPE
* fix #8240: on branch master, when provider and consumer stop cause NPE
* fix #8240: on branch master, when provider and consumer stop cause NPE
---
.../java/org/apache/dubbo/rpc/model/ApplicationModel.java | 5 ++---
.../org/apache/dubbo/config/bootstrap/DubboBootstrap.java | 15 +++++----------
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
index 1c41502..dea4024 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
@@ -25,7 +25,6 @@ import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.context.ConfigManager;
import java.util.Collection;
-import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -118,8 +117,8 @@ public class ApplicationModel {
if (application != null) {
return application;
}
- Optional<ApplicationConfig> appCfgOptional = getConfigManager().getApplication();
- return appCfgOptional.isPresent() ? appCfgOptional.get().getName() : null;
+ return getConfigManager().getApplication()
+ .map(ApplicationConfig::getName).orElse(null);
}
// Currently used by UT.
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
index e6e0307..17ee8cf 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
@@ -1266,13 +1266,13 @@ public class DubboBootstrap {
}
destroyServiceDiscoveries();
destroyExecutorRepository();
- clear();
- shutdown();
+ DubboShutdownHook.destroyAll();
+ clearConfigManager();
+ shutdownExecutor();
release();
ExtensionLoader<DubboBootstrapStartStopListener> exts = getExtensionLoader(DubboBootstrapStartStopListener.class);
exts.getSupportedExtensionInstances().forEach(ext -> ext.onStop(this));
}
- DubboShutdownHook.destroyAll();
} finally {
initialized.set(false);
destroyLock.unlock();
@@ -1295,13 +1295,8 @@ public class DubboBootstrap {
}
}
- private void clear() {
+ private void clearConfigManager() {
clearConfigs();
- clearApplicationModel();
- }
-
- private void clearApplicationModel() {
-
}
private void clearConfigs() {
@@ -1322,7 +1317,7 @@ public class DubboBootstrap {
});
}
- private void shutdown() {
+ private void shutdownExecutor() {
if (!executorService.isShutdown()) {
// Shutdown executorService
executorService.shutdown();