Package org.apache.axis2.clustering.management

Examples of org.apache.axis2.clustering.management.GroupManagementAgent


        return newMC;
    }

    public static void clearSecurtityProperties(Options options) {

        Options current = options;
        while (current != null && current.getProperty(SynapseConstants.RAMPART_POLICY) != null) {
             current.setProperty(SynapseConstants.RAMPART_POLICY, null);
             current = current.getParent();
        }
    }
View Full Code Here


         try {
            configurationContext
                    = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                    clientRepository != null ? clientRepository : DEFAULT_CLIENT_REPO,
                    axis2xml != null ? axis2xml : DEFAULT_AXIS2_XML);
            sc = new ServiceClient(configurationContext, null);
        } catch (AxisFault e) {
            String msg = "Error initializing BlockingMessageSender : " + e.getMessage();
            log.error(msg, e);
            throw new SynapseException(msg, e);
        }
View Full Code Here

        mepClient.execute(true);
        if (wsRMEnabled) {
            Object rm11 = clientOptions.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
            if ( (rm11 != null) && rm11.equals(Sandesha2Constants.SPEC_VERSIONS.v1_1)){
                ServiceClient serviceClient = new ServiceClient(
                        axisOutMsgCtx.getConfigurationContext(), axisOutMsgCtx.getAxisService());
                serviceClient.setTargetEPR(
                        new EndpointReference(endpoint.getAddress(synapseOutMessageContext)));
                serviceClient.setOptions(clientOptions);
                serviceClient.getOptions().setTo(
                        new EndpointReference(endpoint.getAddress(synapseOutMessageContext)));
                SandeshaClient.terminateSequence(serviceClient);
            }
        }
   }
View Full Code Here

    public void init(SynapseEnvironment synapseEnvironment) {
        ConfigurationContext cc =
                ((Axis2SynapseEnvironment) synapseEnvironment).getAxis2ConfigurationContext();
        if (!initialized) {
            // The check for clustering environment
            ClusteringAgent clusteringAgent = cc.getAxisConfiguration().getClusteringAgent();
            if (clusteringAgent != null && clusteringAgent.getStateManager() != null) {
                isClusteringEnabled = Boolean.TRUE;
            } else {
                isClusteringEnabled = Boolean.FALSE;
            }
View Full Code Here

        return lbMembershipHandler;
    }

    public void send(MessageContext synCtx) {
        SessionInformation sessionInformation = null;
        Member currentMember = null;
        ConfigurationContext configCtx =
                ((Axis2MessageContext) synCtx).getAxis2MessageContext().getConfigurationContext();
        if (lbMembershipHandler.getConfigurationContext() == null) {
            lbMembershipHandler.setConfigurationContext(configCtx);
        }
View Full Code Here

    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);
    }
View Full Code Here

   
    @Override
    public Integer call() throws Exception {
        int runningInstances;
        // for each sub domain, get the clustering group management agent
        GroupManagementAgent agent =
            AutoscalerTaskDSHolder.getInstance().getAgent()
                .getGroupManagementAgent(this.domain,
                    this.subDomain);

        // if it isn't null
        if (agent != null) {
            // we calculate running instance count for this service domain
            runningInstances = agent.getMembers().size();
        } else {
            // if agent is null, we assume no service instances are running
            runningInstances = 0;
        }
View Full Code Here

        // here we have to pass tenant id to get domain from hostContext
        String domain = hostContext.getDomainFromTenantId(tenantId);
        String subDomain = hostContext.getSubDomainFromTenantId(tenantId);

        LoadbalanceAlgorithm algorithm = hostContext.getAlgorithm();
        GroupManagementAgent groupMgtAgent = clusteringAgent.getGroupManagementAgent(domain, subDomain);
       
        if (groupMgtAgent == null) {
          String tenantDomain;
            try {
              tenantDomain = ConfigHolder.getInstance().getRealmService().getTenantManager().getDomain(tenantId);
            } catch (UserStoreException ignore) {
              tenantDomain = ""+tenantId;
            }
         
            String msg =
                    "No Group Management Agent found for the domain: " + domain + ", subDomain: "
                        + subDomain + ", host: " + host+ " and for tenant: "
                        +  tenantDomain;
            log.error(msg);
            throw new SynapseException(msg);
        }
        algorithm.setApplicationMembers(groupMgtAgent.getMembers());
        AlgorithmContext context = hostContext.getAlgorithmContext();
        return algorithm.getNextApplicationMember(context);
    }
View Full Code Here

            log.debug("Pending Instances State Checker has started for: " +
                AutoscaleUtil.domainSubDomainString(domain, subDomain) + ". Check expiry time : " + serverStartupDelay);

            // for each sub domain, get the clustering group management agent
            GroupManagementAgent agent =
                AutoscalerTaskDSHolder.getInstance().getAgent()
                    .getGroupManagementAgent(domain,
                        subDomain);
            int startingRunningInstanceCount = agent.getMembers().size();

            // we give some time for the server to get joined, we'll check time to time
            // whether the instance has actually joined the ELB.
            while ((agent.getMembers().size() < (originalRunningInstanceCount + expectedIncrementOfinstanceCount)) &&
                totalWaitedTime < serverStartupDelay) {
                int upToDateRunningInstanceCount = agent.getMembers().size();

                log.debug(AutoscaleUtil.domainSubDomainString(domain, subDomain) +
                    " - Number of current running instances " +
                        upToDateRunningInstanceCount);

                if (upToDateRunningInstanceCount > startingRunningInstanceCount) {
                    int newlyJoinedInstanceCount = upToDateRunningInstanceCount - startingRunningInstanceCount;
                    // set new running instance count
                    groupCtxt.setRunningInstanceCount(upToDateRunningInstanceCount);
                    // decrement the pending instance count
                    groupCtxt.decrementPendingInstancesIfNotZero(newlyJoinedInstanceCount);
                    // update the starting running instance count
                    startingRunningInstanceCount = upToDateRunningInstanceCount;

                    log.debug(AutoscaleUtil.domainSubDomainString(domain, subDomain) +
                        " - Instances newly joined: " +
                            newlyJoinedInstanceCount);
                }

                try {
                    Thread.sleep(AutoscaleConstants.INSTANCE_REMOVAL_CHECK_TIME);
                } catch (InterruptedException ignore) {
                }

                totalWaitedTime += AutoscaleConstants.INSTANCE_REMOVAL_CHECK_TIME;
            }

            log.debug(AutoscaleUtil.domainSubDomainString(domain, subDomain) + "- Waited for : " +
                totalWaitedTime +
                " (milliseconds) till pending members get joined.");

            if (agent.getMembers().size() < (originalRunningInstanceCount + expectedIncrementOfinstanceCount)) {

                int instanceCountFailedToJoin =
                    originalRunningInstanceCount + expectedIncrementOfinstanceCount - agent.getMembers().size();
                log.debug(AutoscaleUtil.domainSubDomainString(domain, subDomain) +
                    "Instances that are failed to join: " +
                        instanceCountFailedToJoin);

                // to avoid an infinite loop
View Full Code Here

                .getServerStartupDelay();
            log.info("Terminating Instances State Checker has started for: " +
                AutoscaleUtil.domainSubDomainString(domain, subDomain) + ". Check expiry time : " + serverStartupDelay);

            // for each sub domain, get the clustering group management agent
            GroupManagementAgent agent =
                AutoscalerTaskDSHolder.getInstance().getAgent()
                    .getGroupManagementAgent(domain,
                        subDomain);

            int startingRunningInstanceCount = agent.getMembers().size();

            // we give some time for the server to be terminated, we'll check time to time
            // whether the instance has actually left the cluster.
            while (agent.getMembers().size() == startingRunningInstanceCount &&
                totalWaitedTime < serverStartupDelay) {

                try {
                    Thread.sleep(AutoscaleConstants.INSTANCE_REMOVAL_CHECK_TIME);
                } catch (InterruptedException ignore) {
View Full Code Here

TOP

Related Classes of org.apache.axis2.clustering.management.GroupManagementAgent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.