org.apache.synapse.endpoints.algorithms
Interface LoadbalanceAlgorithm

All Superinterfaces:
Cloneable
All Known Implementing Classes:
RoundRobin, WeightedRoundRobin, WeightedRRLCAlgorithm

public interface LoadbalanceAlgorithm
extends Cloneable

All load balance algorithms must implement this interface. Implementations of this interface can be registered in LoadbalanceManagers.


Method Summary
 LoadbalanceAlgorithm clone()
           
 String getName()
          Return the name of the load balancing algorithm
 Member getNextApplicationMember(AlgorithmContext algorithmContext)
          This method returns the next member to which the request has been sent to, according to the algorithm implementation.
 Endpoint getNextEndpoint(MessageContext synapseMessageContext, AlgorithmContext algorithmContext)
          This method returns the next node according to the algorithm implementation.
 void reset(AlgorithmContext algorithmContext)
          Resets the algorithm to its initial position.
 void setApplicationMembers(List<Member> members)
          Set the application members
 void setEndpoints(List<Endpoint> endpoints)
          Set the endpoints
 void setLoadBalanceEndpoint(Endpoint endpoint)
          Set the loadbalance endpoint
 

Method Detail

setApplicationMembers

void setApplicationMembers(List<Member> members)
Set the application members

Parameters:
members - The application members

setEndpoints

void setEndpoints(List<Endpoint> endpoints)
Set the endpoints

Parameters:
endpoints - The endpoints

setLoadBalanceEndpoint

void setLoadBalanceEndpoint(Endpoint endpoint)
Set the loadbalance endpoint

Parameters:
endpoint - the endpoint which uses this algorithm

getNextEndpoint

Endpoint getNextEndpoint(MessageContext synapseMessageContext,
                         AlgorithmContext algorithmContext)
This method returns the next node according to the algorithm implementation.

Parameters:
synapseMessageContext - 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

Member getNextApplicationMember(AlgorithmContext algorithmContext)
This method returns the next member to which the request has been sent to, according to the algorithm implementation.

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

void reset(AlgorithmContext algorithmContext)
Resets the algorithm to its initial position. Initial position depends on the implementation.

Parameters:
algorithmContext - The context in which holds run time states related to the algorithm

getName

String getName()
Return the name of the load balancing algorithm

Returns:
the name of the algorithm implemented

clone

LoadbalanceAlgorithm clone()


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.