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

liujun 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 72df0e6  return same reference invokers as much as possible (#6083)
72df0e6 is described below

commit 72df0e6cb70cae808d3b04d64bed5b0e07b49ba3
Author: zjseu2009 <zjseu2...@163.com>
AuthorDate: Wed Jul 1 15:09:08 2020 +0800

    return same reference invokers as much as possible (#6083)
    
    fixes #6082
---
 .../org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
index eb11120..77429b5 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
@@ -193,6 +193,18 @@ public class TagRouter extends AbstractRouter implements 
ConfigurationListener {
     }
 
     private <T> List<Invoker<T>> filterInvoker(List<Invoker<T>> invokers, 
Predicate<Invoker<T>> predicate) {
+        boolean filter = false;
+        for (int i = 0; i < invokers.size(); ++i) {
+            Invoker<T> invoker = invokers.get(i);
+            if (!predicate.test(invoker)) {
+                filter = true;
+                break;
+            }
+        }
+        if (!filter) {
+            return invokers;
+        }
+
         return invokers.stream()
                 .filter(predicate)
                 .collect(Collectors.toList());

Reply via email to