Search in sources :

Example 1 with GroupManagementAgent

use of org.apache.axis2.clustering.management.GroupManagementAgent in project wso2-synapse by wso2.

the class ServiceLoadBalanceMembershipHandler method getNextApplicationMember.

public Member getNextApplicationMember(String host) {
    DomainAlgorithmContext domainAlgorithmContext = getDomainAlgorithmContext(host);
    String lbDomain = domainAlgorithmContext.getDomain();
    LoadbalanceAlgorithm algorithm = domainAlgorithmContext.getAlgorithm();
    GroupManagementAgent groupMgtAgent = clusteringAgent.getGroupManagementAgent(lbDomain);
    if (groupMgtAgent == null) {
        String msg = "A LoadBalanceEventHandler has not been specified in the axis2.xml " + "file for the domain " + lbDomain + " for host " + host;
        log.error(msg);
        throw new SynapseException(msg);
    }
    algorithm.setApplicationMembers(groupMgtAgent.getMembers());
    AlgorithmContext context = domainAlgorithmContext.getAlgorithmContext();
    return algorithm.getNextApplicationMember(context);
}
Also used : AlgorithmContext(org.apache.synapse.endpoints.algorithms.AlgorithmContext) SynapseException(org.apache.synapse.SynapseException) GroupManagementAgent(org.apache.axis2.clustering.management.GroupManagementAgent) LoadbalanceAlgorithm(org.apache.synapse.endpoints.algorithms.LoadbalanceAlgorithm)

Aggregations

GroupManagementAgent (org.apache.axis2.clustering.management.GroupManagementAgent)1 SynapseException (org.apache.synapse.SynapseException)1 AlgorithmContext (org.apache.synapse.endpoints.algorithms.AlgorithmContext)1 LoadbalanceAlgorithm (org.apache.synapse.endpoints.algorithms.LoadbalanceAlgorithm)1