Search in sources :

Example 1 with FileSystemXmlConfig

use of com.hazelcast.config.FileSystemXmlConfig in project hazelcast by hazelcast.

the class ConsoleApp method main.

/**
     * Starts the test application.
     *
     * Loads the config from classpath hazelcast.xml, if it fails to load, will use default config.
     */
public static void main(String[] args) throws Exception {
    Config config;
    try {
        config = new FileSystemXmlConfig("hazelcast.xml");
    } catch (FileNotFoundException e) {
        config = new Config();
    }
    for (int i = 1; i <= LOAD_EXECUTORS_COUNT; i++) {
        config.addExecutorConfig(new ExecutorConfig(EXECUTOR_NAMESPACE + " " + i).setPoolSize(i));
    }
    ConsoleApp consoleApp = new ConsoleApp(Hazelcast.newHazelcastInstance(config));
    consoleApp.start();
}
Also used : ExecutorConfig(com.hazelcast.config.ExecutorConfig) FileSystemXmlConfig(com.hazelcast.config.FileSystemXmlConfig) Config(com.hazelcast.config.Config) FileNotFoundException(java.io.FileNotFoundException) FileSystemXmlConfig(com.hazelcast.config.FileSystemXmlConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig)

Example 2 with FileSystemXmlConfig

use of com.hazelcast.config.FileSystemXmlConfig in project orientdb by orientechnologies.

the class OHazelcastPlugin method configureHazelcast.

protected HazelcastInstance configureHazelcast() throws FileNotFoundException {
    // If hazelcastConfig is null, use the file system XML config.
    if (hazelcastConfig == null) {
        hazelcastConfig = new FileSystemXmlConfig(hazelcastConfigFile);
        hazelcastConfig.setClassLoader(this.getClass().getClassLoader());
    }
    hazelcastConfig.getMapConfig(CONFIG_REGISTEREDNODES).setBackupCount(6);
    hazelcastConfig.getMapConfig(OHazelcastDistributedMap.ORIENTDB_MAP).setMergePolicy(OHazelcastMergeStrategy.class.getName());
    return Hazelcast.newHazelcastInstance(hazelcastConfig);
}
Also used : FileSystemXmlConfig(com.hazelcast.config.FileSystemXmlConfig)

Aggregations

FileSystemXmlConfig (com.hazelcast.config.FileSystemXmlConfig)2 Config (com.hazelcast.config.Config)1 ExecutorConfig (com.hazelcast.config.ExecutorConfig)1 FileNotFoundException (java.io.FileNotFoundException)1