diff options
Diffstat (limited to 'documentapi')
-rw-r--r-- | documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/AdaptiveLoadBalancer.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/AdaptiveLoadBalancer.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/AdaptiveLoadBalancer.java index 6a68a6e122b..621064c178e 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/AdaptiveLoadBalancer.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/AdaptiveLoadBalancer.java @@ -30,14 +30,10 @@ class AdaptiveLoadBalancer extends LoadBalancer { entry = choices.get(0); metrics = getNodeMetrics(entry); } else { - int candA = 0; - int candB = 1; - if (choices.size() > 2) { - candA = random.nextInt(choices.size()); + int candA = random.nextInt(choices.size()); + int candB = random.nextInt(choices.size()); + while (candB == candA) { candB = random.nextInt(choices.size()); - while (candB == candA) { - candB = random.nextInt(choices.size()); - } } entry = choices.get(candA); Mirror.Entry entryB = choices.get(candB); |