Class LoadBalancer
- java.lang.Object
-
- com.yahoo.documentapi.messagebus.protocol.LoadBalancer
-
public class LoadBalancer extends java.lang.Object
Load balances over a set of nodes based on statistics gathered from those nodes.- Author:
- thomasg
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LoadBalancer.Node
static class
LoadBalancer.NodeMetrics
-
Constructor Summary
Constructors Constructor Description LoadBalancer(java.lang.String cluster)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIndex(java.lang.String nodeName)
Returns the index from a node name stringjava.util.List<LoadBalancer.NodeMetrics>
getNodeWeights()
LoadBalancer.Node
getRecipient(java.util.List<com.yahoo.jrt.slobrok.api.Mirror.Entry> choices)
The load balancing operation: Returns a node choice from the given choices, based on previously gathered statistics on the nodes, and a running "position" which is increased by 1 on each call to this.void
received(LoadBalancer.Node node, boolean busy)
-
-
-
Method Detail
-
getNodeWeights
public java.util.List<LoadBalancer.NodeMetrics> getNodeWeights()
-
getIndex
public int getIndex(java.lang.String nodeName)
Returns the index from a node name string
-
getRecipient
public LoadBalancer.Node getRecipient(java.util.List<com.yahoo.jrt.slobrok.api.Mirror.Entry> choices)
The load balancing operation: Returns a node choice from the given choices, based on previously gathered statistics on the nodes, and a running "position" which is increased by 1 on each call to this.- Parameters:
choices
- the node choices, represented as Slobrok entries- Returns:
- the chosen node, or null only if the given choices were zero
-
received
public void received(LoadBalancer.Node node, boolean busy)
-
-