Search in sources :

Example 1 with SALSessions

use of org.apache.synapse.endpoints.dispatch.SALSessions in project wso2-synapse by wso2.

the class SALoadbalanceEndpoint method init.

public void init(SynapseEnvironment synapseEnvironment) {
    ConfigurationContext cc = ((Axis2SynapseEnvironment) synapseEnvironment).getAxis2ConfigurationContext();
    if (!initialized) {
        super.init(synapseEnvironment);
        // Initialize the SAL Sessions if already has not been initialized.
        SALSessions salSessions = SALSessions.getInstance();
        if (!salSessions.isInitialized()) {
            salSessions.initialize(isClusteringEnabled, cc);
        }
        // and it needs way to pick endpoints by name
        if (isClusteringEnabled && (this.getParentEndpoint() == null || !(this.getParentEndpoint() instanceof SALoadbalanceEndpoint))) {
            SALSessions.getInstance().registerChildren(this, getChildren());
        }
    }
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SALSessions(org.apache.synapse.endpoints.dispatch.SALSessions)

Example 2 with SALSessions

use of org.apache.synapse.endpoints.dispatch.SALSessions 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");
    }
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) DefaultGroupManagementAgent(org.apache.axis2.clustering.management.DefaultGroupManagementAgent) SynapseException(org.apache.synapse.SynapseException) ClusteringAgent(org.apache.axis2.clustering.ClusteringAgent) SALSessions(org.apache.synapse.endpoints.dispatch.SALSessions) ServiceLoadBalanceMembershipHandler(org.apache.synapse.core.axis2.ServiceLoadBalanceMembershipHandler)

Example 3 with SALSessions

use of org.apache.synapse.endpoints.dispatch.SALSessions in project wso2-synapse by wso2.

the class DynamicLoadbalanceEndpoint method init.

@Override
public void init(SynapseEnvironment synapseEnvironment) {
    ConfigurationContext cc = ((Axis2SynapseEnvironment) synapseEnvironment).getAxis2ConfigurationContext();
    if (!initialized) {
        super.init(synapseEnvironment);
        if (algorithmContext == null) {
            algorithmContext = new AlgorithmContext(isClusteringEnabled, cc, getName());
        }
        // Initialize the SAL Sessions if already has not been initialized.
        SALSessions salSessions = SALSessions.getInstance();
        if (!salSessions.isInitialized()) {
            salSessions.initialize(isClusteringEnabled, cc);
        }
    }
    log.info("Dynamic load balance endpoint initialized");
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) AlgorithmContext(org.apache.synapse.endpoints.algorithms.AlgorithmContext) SALSessions(org.apache.synapse.endpoints.dispatch.SALSessions)

Aggregations

ConfigurationContext (org.apache.axis2.context.ConfigurationContext)3 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)3 SALSessions (org.apache.synapse.endpoints.dispatch.SALSessions)3 ClusteringAgent (org.apache.axis2.clustering.ClusteringAgent)1 DefaultGroupManagementAgent (org.apache.axis2.clustering.management.DefaultGroupManagementAgent)1 SynapseException (org.apache.synapse.SynapseException)1 ServiceLoadBalanceMembershipHandler (org.apache.synapse.core.axis2.ServiceLoadBalanceMembershipHandler)1 AlgorithmContext (org.apache.synapse.endpoints.algorithms.AlgorithmContext)1