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 fcdfe338fb Cancel availability check for NopServiceDiscovery (#10271)
fcdfe338fb is described below

commit fcdfe338fbede4896b7f67f3a4e7aad52b50e567
Author: huazhongming <[email protected]>
AuthorDate: Tue Jul 5 17:26:45 2022 +0800

    Cancel availability check for NopServiceDiscovery (#10271)
    
    Signed-off-by: crazyhzm <[email protected]>
---
 .../apache/dubbo/registry/client/ServiceDiscoveryRegistry.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
index 3b01639dc0..30eb983edd 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
@@ -51,7 +51,7 @@ import static 
org.apache.dubbo.registry.client.ServiceDiscoveryFactory.getExtens
 
 /**
  * TODO, this bridge implementation is not necessary now, protocol can 
interact with service discovery directly.
- *
+ * <p>
  * ServiceDiscoveryRegistry is a very special Registry implementation, which 
is used to bridge the old interface-level service discovery model
  * with the new service discovery model introduced in 3.0 in a compatible 
manner.
  * <p>
@@ -92,7 +92,7 @@ public class ServiceDiscoveryRegistry extends 
FailbackRegistry {
     protected ServiceDiscoveryRegistry(URL registryURL, ServiceDiscovery 
serviceDiscovery, ServiceNameMapping serviceNameMapping) {
         super(registryURL);
         this.serviceDiscovery = serviceDiscovery;
-        this.serviceNameMapping = 
(AbstractServiceNameMapping)serviceNameMapping;
+        this.serviceNameMapping = (AbstractServiceNameMapping) 
serviceNameMapping;
     }
 
     public ServiceDiscovery getServiceDiscovery() {
@@ -270,6 +270,10 @@ public class ServiceDiscoveryRegistry extends 
FailbackRegistry {
 
     @Override
     public boolean isAvailable() {
+        if (serviceDiscovery instanceof NopServiceDiscovery) {
+            // NopServiceDiscovery is designed for compatibility, check 
availability is meaningless, just return true
+            return true;
+        }
         return !serviceDiscovery.isDestroy() && 
!serviceDiscovery.getServices().isEmpty();
     }
 

Reply via email to