diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2017-02-20 15:19:03 +0100 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2017-02-20 15:19:03 +0100 |
commit | 2e6c473d110321758fd0ef84dfaac42a6b9c2186 (patch) | |
tree | 85f1f1f3d51d18cbe66a34f4fd3ccc2d1f316cda /documentapi | |
parent | 24eab4fe4b661526f327fcb32a045dfbc7f3c998 (diff) |
remove caching of mirror lookup
* the lastLookup value could be indefinitely old and would cause the
LoadBalancer policy to send to machines that had gone down (or even been
removed from the cluster if the message rate was low), since it would
only be updated every 1024 messages.
Diffstat (limited to 'documentapi')
-rw-r--r-- | documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerPolicy.java | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerPolicy.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerPolicy.java index e6123dc3dc2..7a04ab87ac7 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerPolicy.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerPolicy.java @@ -36,8 +36,6 @@ public class LoadBalancerPolicy extends ExternalSlobrokPolicy { String cluster = null; String session = null; private String pattern = null; - private AtomicLong count = new AtomicLong(0); - volatile Mirror.Entry [] lastLookup; LoadBalancer.Metrics metrics; LoadBalancer loadBalancer; @@ -89,10 +87,7 @@ public class LoadBalancerPolicy extends ExternalSlobrokPolicy { @return Returns a hop representing the TCP address of the target, or null if none could be found. */ LoadBalancer.Node getRecipient(RoutingContext context) { - long c = count.getAndIncrement(); - if ((c%1024 == 0) || (lastLookup == null) || (lastLookup.length == 0)) { - lastLookup = lookup(context, pattern); - } + Mirror.Entry [] lastLookup = lookup(context, pattern); return loadBalancer.getRecipient(lastLookup); } |