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 2023/07/26 03:10:59 UTC

[dubbo] branch 3.2 updated: Fix register failed if re-register service discovery (#12795)

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

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


The following commit(s) were added to refs/heads/3.2 by this push:
     new 9837cfbb0b Fix register failed if re-register service discovery (#12795)
9837cfbb0b is described below

commit 9837cfbb0b4e008d976aa02a7a8c0730b4fa3514
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Wed Jul 26 11:10:54 2023 +0800

    Fix register failed if re-register service discovery (#12795)
---
 .../apache/dubbo/registry/client/AbstractServiceDiscovery.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/AbstractServiceDiscovery.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/AbstractServiceDiscovery.java
index 9da383d771..b3b771c20e 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/AbstractServiceDiscovery.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/AbstractServiceDiscovery.java
@@ -132,11 +132,13 @@ public abstract class AbstractServiceDiscovery implements ServiceDiscovery {
         if (isDestroy) {
             return;
         }
-        ServiceInstance serviceInstance = createServiceInstance(this.metadataInfo);
-        if (!isValidInstance(serviceInstance)) {
-            return;
+        if (this.serviceInstance == null) {
+            ServiceInstance serviceInstance = createServiceInstance(this.metadataInfo);
+            if (!isValidInstance(serviceInstance)) {
+                return;
+            }
+            this.serviceInstance = serviceInstance;
         }
-        this.serviceInstance = serviceInstance;
         boolean revisionUpdated = calOrUpdateInstanceRevision(this.serviceInstance);
         if (revisionUpdated) {
             reportMetadata(this.metadataInfo);