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/08 05:09:53 UTC

[dubbo] branch 3.0 updated: [3.0] only unsubscribe not null listener in RegistryProtocol.unexport (#8682)

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 1a12491  [3.0] only unsubscribe not null listener in RegistryProtocol.unexport (#8682)
1a12491 is described below

commit 1a12491a4eaa7646fa62ffb17da798f8539dffb8
Author: zrlw <zr...@sina.com>
AuthorDate: Wed Sep 8 13:09:41 2021 +0800

    [3.0] only unsubscribe not null listener in RegistryProtocol.unexport (#8682)
    
    * only unsubscribe not null listener in RegistryProtocol.unexport
    
    * Update build-and-test-3.yml
---
 .../dubbo/registry/integration/RegistryProtocol.java       | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java
index a6ead17..9fb5b06 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java
@@ -872,12 +872,14 @@ public class RegistryProtocol implements Protocol, ScopeModelAware {
                 if (subscribeUrl != null) {
                     Map<URL, NotifyListener> overrideListeners = getProviderConfigurationListener(subscribeUrl).getOverrideListeners();
                     NotifyListener listener = overrideListeners.remove(registerUrl);
-                    registry.unsubscribe(subscribeUrl, listener);
-                    ApplicationModel applicationModel = getApplicationModel(registerUrl.getScopeModel());
-                    if (applicationModel.getApplicationEnvironment().getConfiguration().convert(Boolean.class, ENABLE_CONFIGURATION_LISTEN, true)) {
-                        applicationModel.getExtensionLoader(GovernanceRuleRepository.class).getDefaultExtension()
-                            .removeListener(subscribeUrl.getServiceKey() + CONFIGURATORS_SUFFIX,
-                                serviceConfigurationListeners.remove(subscribeUrl.getServiceKey()));
+                    if (listener != null) {
+                        registry.unsubscribe(subscribeUrl, listener);
+                        ApplicationModel applicationModel = getApplicationModel(registerUrl.getScopeModel());
+                        if (applicationModel.getApplicationEnvironment().getConfiguration().convert(Boolean.class, ENABLE_CONFIGURATION_LISTEN, true)) {
+                            applicationModel.getExtensionLoader(GovernanceRuleRepository.class).getDefaultExtension()
+                                .removeListener(subscribeUrl.getServiceKey() + CONFIGURATORS_SUFFIX,
+                                        serviceConfigurationListeners.remove(subscribeUrl.getServiceKey()));
+                        }
                     }
                 }
             } catch (Throwable t) {