public class WeightedRoundRobin extends Object implements LoadbalanceAlgorithm, ManagedLifecycle
This algorithm will send the first 5 messages through Epr1, next 3 messages through Epr2 and next 2 messages with Epr3. Then algorithm moves again to the first endpoint and cycle continues.
Constructor and Description |
---|
WeightedRoundRobin() |
Modifier and Type | Method and Description |
---|---|
void |
changeWeight(int pos,
int weight) |
LoadbalanceAlgorithm |
clone() |
void |
destroy()
This method should implement the destroying of the
implemented parts of the configuration.
|
int[] |
getCurrentWeights() |
String |
getName()
Return the name of the load balancing algorithm
|
org.apache.axis2.clustering.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 |
init(SynapseEnvironment se)
This method should implement the initialization of the
implemented parts of the configuration.
|
void |
reset(AlgorithmContext algorithmContext)
Resets the algorithm to its initial position.
|
void |
setApplicationMembers(List<org.apache.axis2.clustering.Member> members)
we are not supporting members
|
void |
setEndpoints(List<Endpoint> endpoints)
Set the endpoints
|
void |
setLoadBalanceEndpoint(Endpoint endpoint)
Set the loadbalance endpoint
|
public void setApplicationMembers(List<org.apache.axis2.clustering.Member> members)
setApplicationMembers
in interface LoadbalanceAlgorithm
members
- The application memberspublic void setEndpoints(List<Endpoint> endpoints)
LoadbalanceAlgorithm
setEndpoints
in interface LoadbalanceAlgorithm
endpoints
- The endpointspublic void setLoadBalanceEndpoint(Endpoint endpoint)
LoadbalanceAlgorithm
setLoadBalanceEndpoint
in interface LoadbalanceAlgorithm
endpoint
- the endpoint which uses this algorithmpublic Endpoint getNextEndpoint(MessageContext synapseMessageContext, AlgorithmContext algorithmContext)
LoadbalanceAlgorithm
getNextEndpoint
in interface LoadbalanceAlgorithm
synapseMessageContext
- SynapseMessageContext of the current messagealgorithmContext
- The context in which holds run time states related to the algorithmpublic org.apache.axis2.clustering.Member getNextApplicationMember(AlgorithmContext algorithmContext)
LoadbalanceAlgorithm
getNextApplicationMember
in interface LoadbalanceAlgorithm
algorithmContext
- The context in which holds run time states related to the algorithmpublic void reset(AlgorithmContext algorithmContext)
LoadbalanceAlgorithm
reset
in interface LoadbalanceAlgorithm
algorithmContext
- The context in which holds run time states related to the algorithmpublic String getName()
LoadbalanceAlgorithm
getName
in interface LoadbalanceAlgorithm
public LoadbalanceAlgorithm clone()
clone
in interface LoadbalanceAlgorithm
clone
in class Object
public void init(SynapseEnvironment se)
ManagedLifecycle
init
in interface ManagedLifecycle
se
- SynapseEnvironment to be used for initializationpublic void destroy()
ManagedLifecycle
destroy
in interface ManagedLifecycle
public void changeWeight(int pos, int weight)
public int[] getCurrentWeights()
Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.