Package org.apache.axis2.clustering

Examples of org.apache.axis2.clustering.ClusteringAgent


        if (subDomain == null || subDomain.isEmpty()) {
            // uses default sub domain
            subDomain = Constants.DEFAULT_SUB_DOMAIN;
        }

        ClusteringAgent clusteringAgent = null;

        try {
            clusteringAgent =
                              ConfigHolder.getInstance().getAxisConfiguration()
                                          .getClusteringAgent();

        } catch (Exception e) {
            String msg = "Failed to retrieve Clustering Agent.";
            log.error(msg, e);
            throw new SynapseException(msg, e);

        }

        if (clusteringAgent == null) {
            String msg = "Clustering Agent is null.";
            log.error(msg);
            throw new SynapseException(msg);
        }

        /*
         * Add Group Management Agent if one is not already present for this domain and sub
         * domain
         */

        if (clusteringAgent.getGroupManagementAgent(domain, subDomain) == null) {
            clusteringAgent.addGroupManagementAgent(new SubDomainAwareGroupManagementAgent(subDomain),
                                                    domain, subDomain,-1);

            if (log.isDebugEnabled()) {
                log.debug("Group management agent added to cluster domain: " + domain +
                          " and sub domain: " + subDomain);
View Full Code Here


        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
            if (hostContexts != null) {
                // iterate through each host context
                for (HostContext hostCtxt : hostContexts.values()) {
                    // each host can has multiple Tenant Contexts, iterate through them
                    for (TenantDomainContext tenantCtxt : hostCtxt.getTenantDomainContexts()) {

                        String domain = tenantCtxt.getDomain();
                        String subDomain = tenantCtxt.getSubDomain();

                        if (clusteringAgent.getGroupManagementAgent(domain, subDomain) == null) {
                            String gmAgentClass = lbConfig.getLoadBalancerConfig().getGroupManagementAgentClass();
                            GroupManagementAgent groupManagementAgent;
                            if (gmAgentClass != null) {
                                try {
                                    groupManagementAgent = (GroupManagementAgent) Class.forName(gmAgentClass).newInstance();
                                } catch (Exception e) {
                                    String msg = "Cannot instantiate GroupManagementAgent. Class: " + gmAgentClass;
                                    log.error(msg, e);
                                    throw new TenantAwareLoadBalanceEndpointException(msg, e);
                                }
                            } else {
                                groupManagementAgent = new SubDomainAwareGroupManagementAgent(subDomain);
                            }
                            clusteringAgent.addGroupManagementAgent(groupManagementAgent,
                                                                    domain, subDomain,-1);
                            if (log.isDebugEnabled()) {
                                log.debug("Group management agent added to cluster domain: " +
                                          domain + " and sub domain: " + subDomain);
                            }
View Full Code Here

LoadBalancerConfiguration lbConfig) {
        Map<String, Map<String, ?>> oldAppDomainContexts =
          (Map<String, Map<String, ?>>) configCtx.getPropertyNonReplicable(AutoscaleConstants.APP_DOMAIN_CONTEXTS);
        Map<String, Map<String, ?>> newAppDomainContexts = new HashMap<String, Map<String, ?>>();
       
            ClusteringAgent clusteringAgent = configCtx.getAxisConfiguration().getClusteringAgent();

            for (String domain : lbConfig.getServiceDomains()) {

                for (String subDomain : lbConfig.getServiceSubDomains(domain)) {
                    if (clusteringAgent.getGroupManagementAgent(domain, subDomain) == null) {
                        throw new SynapseException("Axis2 clustering GroupManagementAgent for domain: " + domain +
                                                   ", sub-domain: " + subDomain +
                                                   " has not been defined");
                    }
View Full Code Here

     * Replicate information needed to take autoscaling decision for other ELBs
     * in the cluster.
     */
    private void sendReplicationMessage() {

        ClusteringAgent clusteringAgent = AutoscalerTaskDSHolder.getInstance().getAgent();
        if (clusteringAgent != null) {
            RequestTokenReplicationCommand msg = new RequestTokenReplicationCommand();
            msg.setAppDomainContexts(appDomainContexts);
            try {
                clusteringAgent.sendMessage(msg, true);
                System.setProperty(AutoscaleConstants.IS_TOUCHED, "false");
                log.debug("Request token replication messages sent out successfully!!");

            } catch (ClusteringFault e) {
                log.error("Failed to send the request token replication message.", e);
View Full Code Here

     * This method will check whether this LB is the primary LB or not and set
     * attribute accordingly.
     */
    private void setIsPrimaryLB() {

        ClusteringAgent clusteringAgent = AutoscalerTaskDSHolder.getInstance().getAgent();
        if (clusteringAgent != null) {

            isPrimaryLoadBalancer = clusteringAgent.isCoordinator();

        }

    }
View Full Code Here

 
  public static void createGroupMgtAgents() {
    lbConfig = ConfigHolder.getInstance().getLbConfig();
    hostContexts = lbConfig.getHostContextMap();
   
    ClusteringAgent clusteringAgent = ConfigHolder.getInstance().getAxisConfiguration().getClusteringAgent();
        if (clusteringAgent == null) {
            throw new SynapseException("Axis2 ClusteringAgent not defined in axis2.xml");
        }

        // Add the Axis2 GroupManagement agents
        if (hostContexts != null) {
            // iterate through each host context
            for (HostContext hostCtxt : hostContexts.values()) {
                // each host can has multiple Tenant Contexts, iterate through them
                for (TenantDomainContext tenantCtxt : hostCtxt.getTenantDomainContexts()) {

                    String domain = tenantCtxt.getDomain();
                    String subDomain = tenantCtxt.getSubDomain();

                    if (clusteringAgent.getGroupManagementAgent(domain, subDomain) == null) {
                        clusteringAgent.addGroupManagementAgent(new SubDomainAwareGroupManagementAgent(
                            subDomain),
                            domain, subDomain, -1);
                        log.info("Group management agent added to cluster domain: " +
                            domain + " and sub domain: " + subDomain);
                    }
View Full Code Here

        }
    }
 
  public static void createGroupMgtAgent(String domain, String subDomain) {
   
    ClusteringAgent clusteringAgent = ConfigHolder.getInstance().getAxisConfiguration().getClusteringAgent();
        if (clusteringAgent == null) {
            throw new SynapseException("Axis2 ClusteringAgent not defined in axis2.xml");
        }
   
        if (clusteringAgent.getGroupManagementAgent(domain, subDomain) == null) {
            clusteringAgent.addGroupManagementAgent(new SubDomainAwareGroupManagementAgent(
                subDomain),
                domain, subDomain, -1);
            log.info("Group management agent added to cluster domain: " +
                domain + " and sub domain: " + subDomain);
        }
View Full Code Here

        }
  }
 
  public static void resetGroupMgtAgent(String domain, String subDomain) {

        ClusteringAgent clusteringAgent =
            ConfigHolder.getInstance().getAxisConfiguration().getClusteringAgent();
       
        if (clusteringAgent == null) {
            throw new SynapseException("Axis2 Clustering Agent not defined in axis2.xml");
        }

        // checks the existence.
        if (clusteringAgent.getGroupManagementAgent(domain, subDomain) != null) {
          
      // FIX THIS IN PROPER WAY
      // This has changed some API of axis2 and we need to send upstream before using it   
            //clusteringAgent.resetGroupManagementAgent(domain, subDomain);
           
View Full Code Here

    SynchronizeGitRepositoryRequest request =
                                              new SynchronizeGitRepositoryRequest(tenantId,
                                                                                  tenantDomain,
                                                                                  uuid);

    ClusteringAgent clusteringAgent =
                                      DataHolder.getServerConfigContext()
                                                .getAxisConfiguration().getClusteringAgent();
    GroupManagementAgent groupMgtAgent =
                                         clusteringAgent.getGroupManagementAgent(clusterDomain,
                                                                                 clusterSubdomain);

    try {
      log.info("Sending Request to.. " + clusterDomain + " : " + clusterSubdomain);
      groupMgtAgent.send(request);
View Full Code Here

    private static final Log log = LogFactory.getLog(TenantActivityUtil.class);

    public static List<TenantDataBean> getActiveTenantsInCluster() throws AxisFault {
        List<TenantDataBean> tenants = new ArrayList<TenantDataBean>();
        try {
            ClusteringAgent agent = getClusteringAgent();
            List<ClusteringCommand> list = agent.sendMessage(new GetActiveTenantsInMemberRequest(), true);
            if (log.isDebugEnabled()) {
                log.debug("sent cluster command to to get Active tenants on cluster");
            }
            for (ClusteringCommand command : list) {
                if (command instanceof GetActiveTenantsInMemberResponse) {
View Full Code Here

TOP

Related Classes of org.apache.axis2.clustering.ClusteringAgent

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.