Class LoadBalancer


  • public class LoadBalancer
    extends java.lang.Object
    Load balances over a set of nodes based on statistics gathered from those nodes.
    Author:
    thomasg
    • 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 string
      java.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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoadBalancer

        public LoadBalancer​(java.lang.String cluster)
    • Method Detail

      • 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