Package org.apache.stratos.cartridge.agent

Examples of org.apache.stratos.cartridge.agent.ClusteringClient


    public boolean register(Registrant registrant) throws CartridgeAgentException {

        MessageContext messageContext = MessageContext.getCurrentMessageContext();
        ConfigurationContext configurationContext = messageContext.getConfigurationContext();
        ClusteringClient clusteringClient =
                (ClusteringClient) configurationContext.getProperty(CartridgeAgentConstants.CLUSTERING_CLIENT);
        if (registrant.getRemoteHost() == null || registrant.getRemoteHost().isEmpty()) {
            String remoteAddr = (String) messageContext.getProperty("REMOTE_ADDR");
            registrant.setRemoteHost(remoteAddr);
        }
        log.info("Trying to add new registrant " + registrant + "...");
        clusteringClient.joinGroup(registrant, configurationContext);
        DataHolder.getHealthChecker().start(registrant);
        return true;

    }
View Full Code Here


    public boolean unregister(String domain, String subDomain, String hostName) throws CartridgeAgentException {

        MessageContext messageContext = MessageContext.getCurrentMessageContext();
        ConfigurationContext configurationContext = messageContext.getConfigurationContext();
        ClusteringClient clusteringClient =
                (ClusteringClient) configurationContext.getProperty(CartridgeAgentConstants.CLUSTERING_CLIENT);
        clusteringClient.removeClusterDomain(domain, subDomain, hostName, configurationContext);
        return true;

    }
View Full Code Here

        }
           
            RegistrantDatabase registrantDatabase = new RegistrantDatabase();
//            AxisServer axisServer = new AxisServer();
//            ConfigurationContext configurationContext = axisServer.getConfigurationContext();
            ClusteringClient clusteringClient = new ClusteringClient(registrantDatabase);
            configurationContext.setProperty(CartridgeAgentConstants.CLUSTERING_CLIENT, clusteringClient);

            String healthCheckInterval = conf.getProperty("registrant.heathCheckInterval");
            String threadPoolSize = conf.getProperty("registrant.healthCheckThreadPoolSize");
            int healthCheckIntervalInt =
                    (healthCheckInterval == null) ? 2000 : Integer.parseInt(healthCheckInterval);
            int threadPoolSizeInt =
                    (threadPoolSize == null) ? 10 : Integer.parseInt(healthCheckInterval);
            log.info("Registrant health check interval: " + healthCheckIntervalInt + "s");
            healthChecker = new RegistrantHealthChecker(registrantDatabase,
                    clusteringClient,
                    configurationContext,
                    healthCheckIntervalInt,
                    threadPoolSizeInt
            );
            clusteringClient.init(conf,
                    configurationContext,
                    new ELBMembershipListener(clusteringClient,
                            configurationContext,
                            registrantDatabase,
                            healthChecker));
View Full Code Here

TOP

Related Classes of org.apache.stratos.cartridge.agent.ClusteringClient

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.