Class RoundRobin

  • All Implemented Interfaces:
    Cloneable, LoadbalanceAlgorithm

    public class RoundRobin
    extends Object
    implements LoadbalanceAlgorithm
    This is the implementation of the round robin load balancing algorithm. It simply iterates through the endpoint list one by one for until an active endpoint is found.
    • Constructor Detail

      • RoundRobin

        public RoundRobin()
      • RoundRobin

        public RoundRobin​(List endpoints)
    • Method Detail

      • getNextEndpoint

        public Endpoint getNextEndpoint​(MessageContext synCtx,
                                        AlgorithmContext algorithmContext)
        Choose an active endpoint using the round robin algorithm. If there are no active endpoints available, returns null.
        Specified by:
        getNextEndpoint in interface LoadbalanceAlgorithm
        Parameters:
        synCtx - MessageContext instance which holds all per-message properties
        algorithmContext - The context in which holds run time states related to the algorithm
        Returns:
        endpoint to send the next message
      • getNextApplicationMember

        public org.apache.axis2.clustering.Member getNextApplicationMember​(AlgorithmContext algorithmContext)
        Description copied from interface: LoadbalanceAlgorithm
        This method returns the next member to which the request has been sent to, according to the algorithm implementation.
        Specified by:
        getNextApplicationMember in interface LoadbalanceAlgorithm
        Parameters:
        algorithmContext - The context in which holds run time states related to the algorithm
        Returns:
        Next application member to which the request has to be sent to
      • reset

        public void reset​(AlgorithmContext algorithmContext)
        Description copied from interface: LoadbalanceAlgorithm
        Resets the algorithm to its initial position. Initial position depends on the implementation.
        Specified by:
        reset in interface LoadbalanceAlgorithm
        Parameters:
        algorithmContext - The context in which holds run time states related to the algorithm