Class RoundRobin
- java.lang.Object
-
- org.apache.synapse.endpoints.algorithms.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 Summary
Constructors Constructor Description RoundRobin()RoundRobin(List endpoints)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoadbalanceAlgorithmclone()StringgetName()Return the name of the load balancing algorithmorg.apache.axis2.clustering.MembergetNextApplicationMember(AlgorithmContext algorithmContext)This method returns the next member to which the request has been sent to, according to the algorithm implementation.EndpointgetNextEndpoint(MessageContext synCtx, AlgorithmContext algorithmContext)Choose an active endpoint using the round robin algorithm.voidreset(AlgorithmContext algorithmContext)Resets the algorithm to its initial position.voidsetApplicationMembers(List<org.apache.axis2.clustering.Member> members)Set the application membersvoidsetEndpoints(List<Endpoint> endpoints)Set the endpointsvoidsetLoadBalanceEndpoint(Endpoint endpoint)Set the loadbalance endpoint
-
-
-
Constructor Detail
-
RoundRobin
public RoundRobin()
-
RoundRobin
public RoundRobin(List endpoints)
-
-
Method Detail
-
setApplicationMembers
public void setApplicationMembers(List<org.apache.axis2.clustering.Member> members)
Description copied from interface:LoadbalanceAlgorithmSet the application members- Specified by:
setApplicationMembersin interfaceLoadbalanceAlgorithm- Parameters:
members- The application members
-
setEndpoints
public void setEndpoints(List<Endpoint> endpoints)
Description copied from interface:LoadbalanceAlgorithmSet the endpoints- Specified by:
setEndpointsin interfaceLoadbalanceAlgorithm- Parameters:
endpoints- The endpoints
-
setLoadBalanceEndpoint
public void setLoadBalanceEndpoint(Endpoint endpoint)
Description copied from interface:LoadbalanceAlgorithmSet the loadbalance endpoint- Specified by:
setLoadBalanceEndpointin interfaceLoadbalanceAlgorithm- Parameters:
endpoint- the endpoint which uses this algorithm
-
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:
getNextEndpointin interfaceLoadbalanceAlgorithm- Parameters:
synCtx- MessageContext instance which holds all per-message propertiesalgorithmContext- 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:LoadbalanceAlgorithmThis method returns the next member to which the request has been sent to, according to the algorithm implementation.- Specified by:
getNextApplicationMemberin interfaceLoadbalanceAlgorithm- 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
-
clone
public LoadbalanceAlgorithm clone()
- Specified by:
clonein interfaceLoadbalanceAlgorithm- Overrides:
clonein classObject
-
reset
public void reset(AlgorithmContext algorithmContext)
Description copied from interface:LoadbalanceAlgorithmResets the algorithm to its initial position. Initial position depends on the implementation.- Specified by:
resetin interfaceLoadbalanceAlgorithm- Parameters:
algorithmContext- The context in which holds run time states related to the algorithm
-
getName
public String getName()
Description copied from interface:LoadbalanceAlgorithmReturn the name of the load balancing algorithm- Specified by:
getNamein interfaceLoadbalanceAlgorithm- Returns:
- the name of the algorithm implemented
-
-