Package com.hazelcast.config

Examples of com.hazelcast.config.Config


            this.entryCount = entryCount;
            this.threadCount = threadCount;
            this.valueSize = valueSize;
            this.nodeId = nodeId;
            es = Executors.newFixedThreadPool(threadCount);
            Config cfg = new XmlConfigBuilder().build();
            hazelcast = Hazelcast.newHazelcastInstance(cfg);
            esStats = Executors.newSingleThreadExecutor();
            createTime = System.currentTimeMillis();
        }
View Full Code Here


            clusterMapName = mapName;
        } else {
            clusterMapName = "_web_" + servletContext.getServletContextName();
        }
        try {
            Config hzConfig = hazelcastInstance.getConfig();
            String sessionTTL = getParam("session-ttl-seconds");
            if (sessionTTL != null) {
                MapConfig mapConfig = hzConfig.getMapConfig(clusterMapName);
                mapConfig.setTimeToLiveSeconds(Integer.parseInt(sessionTTL));
                hzConfig.addMapConfig(mapConfig);
            }
        } catch (UnsupportedOperationException ignored) {
            // client cannot access Config.
        }
        String cookieName = getParam("cookie-name");
View Full Code Here

     *
     * @param args none
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        Config config;

        try {
            config = new FileSystemXmlConfig("hazelcast.xml");
        } catch (FileNotFoundException e) {
            config = new Config();
        }

        for (int k = 1; k <= LOAD_EXECUTORS_COUNT; k++) {
            config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k));
        }
        TestApp testApp = new TestApp(Hazelcast.newHazelcastInstance(config));
        testApp.start(args);
    }
View Full Code Here

                }
            }
            return HazelcastClient.newHazelcastClient(clientConfig);
        }

        Config config;
        if (configUrl == null) {
            config = new XmlConfigBuilder().build();
        } else {
            try {
                config = new UrlXmlConfig(configUrl);
            } catch (IOException e) {
                throw new ServletException(e);
            }
        }

        if (!isEmpty(instanceName)) {
            if(logger.isLoggable(Level.INFO)){
                logger.info(format("Getting an existing or creating a new HazelcastInstance for session replication, using name '%s'",instanceName));
            }
            config.setInstanceName(instanceName);
            return Hazelcast.getOrCreateHazelcastInstance(config);
        } else {
            logger.info("Creating a new HazelcastInstance for session replication");
            return Hazelcast.newHazelcastInstance(config);
        }
View Full Code Here

    }

    public static long getMaxOperationTimeout(HazelcastInstance instance) {
        String maxOpTimeoutProp = null;
        try {
            Config config = instance.getConfig();
            maxOpTimeoutProp = config.getProperty(GroupProperties.PROP_OPERATION_CALL_TIMEOUT_MILLIS);
        } catch (UnsupportedOperationException ignored) {
            // HazelcastInstance is instance of HazelcastClient.
        }
        if (maxOpTimeoutProp != null) {
            return Long.parseLong(maxOpTimeoutProp);
View Full Code Here

        this.entryCount = entryCount;
        this.valueSize = valueSize;
        this.getPercentage = getPercentage;
        this.putPercentage = putPercentage;
        this.load = load;
        Config cfg = new XmlConfigBuilder().build();

        instance = Hazelcast.newHazelcastInstance(cfg);
        logger = instance.getLoggingService().getLogger("SimpleMapTest");
        random = new Random();
    }
View Full Code Here

* Hazelcast configuration factory.
*/
public class HazelcastConfigurationFactory {

    public static Config build(String name, String password) {
        Config config = new Config();
        GroupConfig groupConfig = new GroupConfig();
        groupConfig.setName(name);
        groupConfig.setPassword(password);
        config.setGroupConfig(groupConfig);
        return config;
    }
View Full Code Here

     *
     * @return the Hazelcast config.
     */
    public Config getHazelcastConfig() {
        System.setProperty("hazelcast.config", xmlConfigLocation);
        Config config = new XmlConfigBuilder().build();
        if (discoveredMemberSet != null) {
            TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
            tcpIpConfig.getMembers().addAll(discoveredMemberSet);
        }
        return config;
    }
View Full Code Here

    }

    public void update(Map properties) {
      if (configurationManager.isUpdated(properties)) {
        LOGGER.debug("CELLAR HAZELCAST: configuration update is true");
        Config config = instance.getConfig();
        TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
        List<String> members = tcpIpConfig.getMembers();
       
        Set<String> discoveredMemberSet = configurationManager.getDiscoveredMemberSet();
        discoveredMemberSet.removeAll(members);
       
View Full Code Here

                // we don't want any of the XmlConfigBuilder warnings as set the config programatically
                Logger.getLogger("com.hazelcast.config.XmlConfigBuilder").setLevel(Level.SEVERE);
                }
        }

        Config config = getHazelcastConfig();

        // do this when theres a way to have adders be the key owners
        // config.getMapConfig(configURI.getDomainName() + "/Endpoints").setBackupCount(0);

        // this caches reads locally
        config.getMapConfig("default").setNearCacheConfig(new NearCacheConfig(0, 0, "NONE", 0, true));

        // Disable the Hazelcast shutdown hook as Tuscany has its own and with both there are race conditions
        config.setProperty("hazelcast.shutdownhook.enabled",
                           // GroupProperties.PROP_SHUTDOWNHOOK_ENABLED,
                           "false");
       
        // By default this is 5 seconds, not sure what the implications are but dropping it down to 1 makes
        // things like the samples look much faster
        config.setProperty("hazelcast.wait.seconds.before.join",
                           // GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN,
                           "1");

        this.hazelcastInstance = Hazelcast.newHazelcastInstance(config);
        if (logger.isLoggable(Level.INFO)) {
View Full Code Here

TOP

Related Classes of com.hazelcast.config.Config

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.