You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by je...@apache.org on 2018/08/06 07:41:24 UTC

[incubator-dubbo] branch master updated: #2188 ConsistentHashLoadBalance selectForKey can optimization (#2190)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6ebc183  #2188 ConsistentHashLoadBalance selectForKey can optimization (#2190)
6ebc183 is described below

commit 6ebc183173eef83d77208ae8a7f1cda2ccf3b977
Author: huangyunbin <39...@qq.com>
AuthorDate: Mon Aug 6 15:41:14 2018 +0800

    #2188 ConsistentHashLoadBalance selectForKey can optimization (#2190)
---
 .../apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
index 31749b2..8671cde 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
@@ -103,7 +103,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
         }
 
         private Invoker<T> selectForKey(long hash) {
-            Map.Entry<Long, Invoker<T>> entry = virtualInvokers.tailMap(hash, true).firstEntry();
+            Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash);
             if (entry == null) {
                 entry = virtualInvokers.firstEntry();
             }