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 2021/09/12 12:10:39 UTC

[dubbo] branch 3.0 updated: fix issue-8741: consumer and provider have same tag, but no provider found (#8763)

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 2c60b8e  fix issue-8741: consumer and provider have same tag, but no provider found (#8763)
2c60b8e is described below

commit 2c60b8ee630ad430a9c27a48700303f5a1a31f31
Author: changfu <ch...@gmail.com>
AuthorDate: Sun Sep 12 20:10:31 2021 +0800

    fix issue-8741: consumer and provider have same tag, but no provider found (#8763)
---
 .../apache/dubbo/rpc/cluster/router/tag/TagStaticStateRouter.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStaticStateRouter.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStaticStateRouter.java
index 34317ab..8ede3c1 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStaticStateRouter.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStaticStateRouter.java
@@ -55,7 +55,7 @@ public class TagStaticStateRouter extends AbstractStateRouter {
     public <T> BitList<Invoker<T>> route(BitList<Invoker<T>> invokers, RouterCache<T> routerCache, URL url, Invocation invocation)
         throws RpcException {
 
-        String tag = StringUtils.isEmpty(invocation.getAttachment(TAG_KEY)) ? url.getParameter(TAG_KEY) :
+        String tag = isNoTag(invocation.getAttachment(TAG_KEY)) ? url.getParameter(TAG_KEY) :
             invocation.getAttachment(TAG_KEY);
         if (StringUtils.isEmpty(tag)) {
             tag = NO_TAG;
@@ -69,6 +69,10 @@ public class TagStaticStateRouter extends AbstractStateRouter {
         return invokers.intersect(res, invokers.getUnmodifiableList());
     }
 
+    private boolean isNoTag(String tag) {
+        return StringUtils.isEmpty(tag) || NO_TAG.equals(tag);
+    }
+
     @Override
     protected List<String> getTags(URL url, Invocation invocation) {
         List<String> tags = new ArrayList<>();