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

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


The following commit(s) were added to refs/heads/master by this push:
     new c22d746  Fix the issue of taking the zone parameter value in 
ZoneAwareClusterInvoker (#8521)
c22d746 is described below

commit c22d746d9918009a32653c1fa26f45e8cace56f0
Author: 灼华 <[email protected]>
AuthorDate: Mon Aug 23 13:07:19 2021 +0800

    Fix the issue of taking the zone parameter value in ZoneAwareClusterInvoker 
(#8521)
---
 .../rpc/cluster/support/registry/ZoneAwareClusterInvoker.java      | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java
index 7fe4b43..dda072f 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java
@@ -40,7 +40,6 @@ import java.util.Set;
 import java.util.stream.Collectors;
 
 import static 
org.apache.dubbo.common.constants.RegistryConstants.LOADBALANCE_AMONG_REGISTRIES;
-import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_ZONE;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_ZONE_FORCE;
 import static org.apache.dubbo.common.constants.RegistryConstants.ZONE_KEY;
@@ -58,8 +57,6 @@ import static 
org.apache.dubbo.config.RegistryConfig.PREFER_REGISTRY_KEY;
 public class ZoneAwareClusterInvoker<T> extends AbstractClusterInvoker<T> {
 
     private static final Logger logger = 
LoggerFactory.getLogger(ZoneAwareClusterInvoker.class);
-    
-    private static final String PREFER_REGISTRY_WITH_ZONE_KEY = REGISTRY_KEY + 
"." + ZONE_KEY;
 
     private final LoadBalance loadBalanceAmongRegistries = 
ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(LOADBALANCE_AMONG_REGISTRIES);
 
@@ -84,7 +81,7 @@ public class ZoneAwareClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
         if (StringUtils.isNotEmpty(zone)) {
             for (Invoker<T> invoker : invokers) {
                 ClusterInvoker<T> clusterInvoker = (ClusterInvoker<T>) invoker;
-                if (clusterInvoker.isAvailable() && 
zone.equals(clusterInvoker.getRegistryUrl().getParameter(PREFER_REGISTRY_WITH_ZONE_KEY)))
 {
+                if (clusterInvoker.isAvailable() && 
zone.equals(clusterInvoker.getRegistryUrl().getParameter(ZONE_KEY))) {
                     return clusterInvoker.invoke(invocation);
                 }
             }
@@ -248,4 +245,4 @@ public class ZoneAwareClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
         }
     }
 
-}
\ No newline at end of file
+}

Reply via email to