Class WeightedRRLCAlgorithm

  • All Implemented Interfaces:
    Cloneable, LoadbalanceAlgorithm, ManagedLifecycle

    public class WeightedRRLCAlgorithm
    extends Object
    implements LoadbalanceAlgorithm, ManagedLifecycle
    This is a Weighted Round Robin Least Connection algorithm.

    This algorithm is similar to WeightedRoundRobin algorithm except it takes the active connections made by the endpoints in to account. Weights assinged to each endpoint and these are static weights. But depending on the active connections these weights are changed dynamically during the execution.

    Algorithm assumes that the endpoint connections to total connection ratio should be eqault to endpoint weight to total weights ratio. If the ratios are different it tries to align them by changing the weights dynamically.

    • Constructor Detail

      • WeightedRRLCAlgorithm

        public WeightedRRLCAlgorithm()
    • Method Detail

      • getNextEndpoint

        public Endpoint getNextEndpoint​(MessageContext messageContext,
                                        AlgorithmContext algorithmContext)
        Description copied from interface: LoadbalanceAlgorithm
        This method returns the next node according to the algorithm implementation.
        Specified by:
        getNextEndpoint in interface LoadbalanceAlgorithm
        Parameters:
        messageContext - SynapseMessageContext of the current message
        algorithmContext - The context in which holds run time states related to the algorithm
        Returns:
        Next node for directing the 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
      • getEndpointCursor

        public int getEndpointCursor()
      • getRoundsPerRecalculation

        public int getRoundsPerRecalculation()
      • getCurrentRound

        public int getCurrentRound()
      • getTotalWeight

        public int getTotalWeight()
      • getTotalConnections

        public int getTotalConnections()
      • init

        public void init​(SynapseEnvironment se)
        Description copied from interface: ManagedLifecycle
        This method should implement the initialization of the implemented parts of the configuration.
        Specified by:
        init in interface ManagedLifecycle
        Parameters:
        se - SynapseEnvironment to be used for initialization
      • destroy

        public void destroy()
        Description copied from interface: ManagedLifecycle
        This method should implement the destroying of the implemented parts of the configuration.
        Specified by:
        destroy in interface ManagedLifecycle