dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] zonghaishang commented on a change in pull request #2172: Optimize leastActiveSelect and weight test case
Date Fri, 21 Sep 2018 04:17:23 GMT
zonghaishang commented on a change in pull request #2172: Optimize leastActiveSelect and weight
test case
URL: https://github.com/apache/incubator-dubbo/pull/2172#discussion_r219379341
 
 

 ##########
 File path: dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java
 ##########
 @@ -70,7 +68,7 @@
         }
         if (!sameWeight && totalWeight > 0) {
             // If (not every invoker has the same weight & at least one invoker's weight>0),
select randomly based on totalWeight.
-            int offsetWeight = ThreadLocalRandom.current().nextInt(totalWeight);
+            int offsetWeight = ThreadLocalRandom.current().nextInt(totalWeight) + 1;
 
 Review comment:
   Why change `ThreadLocalRandom.current().nextInt(totalWeight)` to `ThreadLocalRandom.current().nextInt(totalWeight)
+ 1` ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Mime
View raw message