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/22 06:52:27 UTC

[dubbo] branch 3.0 updated: Fix destroy notify order (#8873)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 6678dc6  Fix destroy notify order (#8873)
6678dc6 is described below

commit 6678dc631d3d93721cf0bf91c56c3f8e98486b09
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Wed Sep 22 14:52:17 2021 +0800

    Fix destroy notify order (#8873)
---
 .../src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java   | 5 +++--
 .../src/main/java/org/apache/dubbo/rpc/model/FrameworkModel.java     | 4 ++--
 .../src/main/java/org/apache/dubbo/rpc/model/ModuleModel.java        | 3 +--
 3 files changed, 6 insertions(+), 6 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 932dc6d..1d9f18f 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
@@ -206,6 +206,9 @@ public class ApplicationModel extends ScopeModel {
         for (ModuleModel moduleModel : new ArrayList<>(moduleModels)) {
             moduleModel.destroy();
         }
+
+        notifyDestroy();
+
         if (defaultInstance == this) {
             synchronized (ApplicationModel.class) {
                 frameworkModel.removeApplication(this);
@@ -220,8 +223,6 @@ public class ApplicationModel extends ScopeModel {
             deployer = null;
         }
 
-        notifyDestroy();
-
         if (environment != null) {
             environment.destroy();
             environment = null;
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/FrameworkModel.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/FrameworkModel.java
index 6ed1917..3731527 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/FrameworkModel.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/FrameworkModel.java
@@ -76,14 +76,14 @@ public class FrameworkModel extends ScopeModel {
             applicationModel.destroy();
         }
 
+        notifyDestroy();
+
         allInstances.remove(this);
         if (defaultInstance == this) {
             synchronized (FrameworkModel.class) {
                 defaultInstance = null;
             }
         }
-
-        notifyDestroy();
     }
 
     public static FrameworkModel defaultModel() {
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleModel.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleModel.java
index d034257..e11c1b5 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleModel.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleModel.java
@@ -82,6 +82,7 @@ public class ModuleModel extends ScopeModel {
 
     @Override
     public void onDestroy() {
+        notifyDestroy();
         applicationModel.removeModule(this);
 
         if (deployer != null) {
@@ -93,8 +94,6 @@ public class ModuleModel extends ScopeModel {
             serviceRepository = null;
         }
 
-        notifyDestroy();
-
         if (moduleEnvironment != null) {
             moduleEnvironment.destroy();
             moduleEnvironment = null;