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_r219379476
 
 

 ##########
 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:
   Is it possible that +1 causes offset not equal or less 0?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to