Skip to content

Commit

Permalink
Cancel availability check for NopServiceDiscovery (apache#10271)
Browse files Browse the repository at this point in the history
Signed-off-by: crazyhzm <[email protected]>
  • Loading branch information
CrazyHZM authored Jul 5, 2022
1 parent 7a1239f commit fcdfe33
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

/**
* 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>
Expand Down Expand Up @@ -92,7 +92,7 @@ public ServiceDiscoveryRegistry(URL registryURL, ApplicationModel applicationMod
protected ServiceDiscoveryRegistry(URL registryURL, ServiceDiscovery serviceDiscovery, ServiceNameMapping serviceNameMapping) {
super(registryURL);
this.serviceDiscovery = serviceDiscovery;
this.serviceNameMapping = (AbstractServiceNameMapping)serviceNameMapping;
this.serviceNameMapping = (AbstractServiceNameMapping) serviceNameMapping;
}

public ServiceDiscovery getServiceDiscovery() {
Expand Down Expand Up @@ -270,6 +270,10 @@ public List<URL> lookup(URL url) {

@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();
}

Expand Down

0 comments on commit fcdfe33

Please sign in to comment.