use of org.apache.synapse.core.axis2.ServiceLoadBalanceMembershipHandler in project wso2-synapse by wso2.
the class ServiceDynamicLoadbalanceEndpoint method init.
@Override
public void init(SynapseEnvironment synapseEnvironment) {
if (!initialized) {
super.init(synapseEnvironment);
ConfigurationContext cfgCtx = ((Axis2SynapseEnvironment) synapseEnvironment).getAxis2ConfigurationContext();
ClusteringAgent clusteringAgent = cfgCtx.getAxisConfiguration().getClusteringAgent();
if (clusteringAgent == null) {
throw new SynapseException("Axis2 ClusteringAgent not defined in axis2.xml");
}
// Add the Axis2 GroupManagement agents
for (String domain : hostDomainMap.values()) {
if (clusteringAgent.getGroupManagementAgent(domain) == null) {
clusteringAgent.addGroupManagementAgent(new DefaultGroupManagementAgent(), domain);
}
}
slbMembershipHandler = new ServiceLoadBalanceMembershipHandler(hostDomainMap, getAlgorithm(), cfgCtx, isClusteringEnabled, getName());
// Initialize the SAL Sessions if already has not been initialized.
SALSessions salSessions = SALSessions.getInstance();
if (!salSessions.isInitialized()) {
salSessions.initialize(isClusteringEnabled, cfgCtx);
}
initialized = true;
log.info("ServiceDynamicLoadbalanceEndpoint initialized");
}
}
Aggregations