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 2022/07/06 06:28:01 UTC
[dubbo] 04/07: Cancel availability check for NopServiceDiscovery (#10271)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git
commit d82310292e337e48364f96b916a1056af8d82e43
Author: huazhongming <cr...@gmail.com>
AuthorDate: Tue Jul 5 17:26:45 2022 +0800
Cancel availability check for NopServiceDiscovery (#10271)
Signed-off-by: crazyhzm <cr...@gmail.com>
---
.../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();
}