/** * Initialization of HazelCast with config fileName (and properties) * * @param hazelCastConfig */ public CacheManagerHazelCast(String xmlConfigFileName, Properties systemProperties) { this(new ClasspathXmlConfig(xmlConfigFileName), systemProperties); }
Config config = new ClasspathXmlConfig("hazelcast.xml")
private static void initClusters() throws IOException { clusterA = Hazelcast.newHazelcastInstance(new ClasspathXmlConfig("hazelcast-solace-clusterA.xml")); } }
@Bean public Config config(Environment environment) { return new ClasspathXmlConfig("hazelcast.xml"); }
private static void initClusters() { clusterB = Hazelcast.newHazelcastInstance(new ClasspathXmlConfig("hazelcast-solace-clusterB.xml")); }
/** * <p>IMDG is configured from an XML file, or you can * do it from Java. * </p> * <p>Or you can do it from XML then extend from Java, * but this is very confusing. * </p> * * @return IMDG configuration */ @Bean public Config config() { return new ClasspathXmlConfig("hazelcast.xml"); }
/** * Create a Hazelcast server as a Spring bean. * * @return A Hazelcast server singleton */ @Bean public HazelcastInstance hazelcastInstance() { Config config = new ClasspathXmlConfig("hazelcast.xml"); return Hazelcast.newHazelcastInstance(config); } }
public HazelcastInstanceMgr(String hazelcastConfigFile) { this.conf =new ClasspathXmlConfig(hazelcastConfigFile); }
public HazelcastInstanceMgr(String hazelcastConfigFile) { this.conf =new ClasspathXmlConfig(hazelcastConfigFile); }
public static void main(String[] args) { Config config = new ClasspathXmlConfig("hazelcast.xml"); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); IdGenerator idGenerator = hz.getIdGenerator ("idGenerator "); IMap someMap = hz.getMap("somemap-"+ idGenerator . newId ()); }
public static void main(String[] args) { Config cfg = new ClasspathXmlConfig("hazelcast.xml"); Hazelcast.newHazelcastInstance(cfg); Hazelcast.newHazelcastInstance(cfg); HazelcastInstance hz = Hazelcast.newHazelcastInstance(cfg); Map<Double, Integer> map = hz.getMap("example"); for (int i = 0; i < 30000; i++) { if (i % 1000 == 0) { System.out.println("Adding " + i + "th element to map"); } map.put(Math.random(), i); } while (true) { sleepMillis(500); System.out.println(hz.getPartitionService().isClusterSafe()); System.out.println(hz.getMap("example").size()); } } }
private void configureCluster(IConfig config) throws FileNotFoundException { LOG.info("Configuring embedded Hazelcast instance"); String interceptHandlerClassname = config.getProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME); if (interceptHandlerClassname == null || !HZ_INTERCEPT_HANDLER.equals(interceptHandlerClassname)) { LOG.info("There are no Hazelcast intercept handlers. The server won't start a Hazelcast instance."); return; } String hzConfigPath = config.getProperty(BrokerConstants.HAZELCAST_CONFIGURATION); if (hzConfigPath != null) { boolean isHzConfigOnClasspath = this.getClass().getClassLoader().getResource(hzConfigPath) != null; Config hzconfig = isHzConfigOnClasspath ? new ClasspathXmlConfig(hzConfigPath) : new FileSystemXmlConfig(hzConfigPath); LOG.info("Starting Hazelcast instance. ConfigurationFile={}", hzconfig); hazelcastInstance = Hazelcast.newHazelcastInstance(hzconfig); } else { LOG.info("Starting Hazelcast instance with default configuration"); hazelcastInstance = Hazelcast.newHazelcastInstance(); } listenOnHazelCastMsg(); }
Config conf =new ClasspathXmlConfig("hazelcast-docker-swarm-discovery-spi-example-address-picker.xml"); Config conf =new ClasspathXmlConfig("hazelcast-docker-swarm-discovery-spi-example-member-address-provider.xml"); } else if (System.getProperty("swarm-bind-method").equalsIgnoreCase("dockerDNSRR")) { Config conf = new ClasspathXmlConfig( "hazelcast-docker-swarm-dnsrr-discovery-spi-example.xml" );
public static void main(String[] args) throws Exception { Config conf =new ClasspathXmlConfig("hazelcast-consul-discovery-spi-example.xml"); HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(conf); Thread.currentThread().sleep(300000); System.exit(0); } }
public com.hazelcast.config.Config getHazelcastConfig() { System.setProperty("hazelcast.logging.type", "slf4j"); com.hazelcast.config.Config hzlCfg = new ClasspathXmlConfig(getHazelcastConfigFile()); hzlCfg.getGroupConfig().setName(HAZELCAST_FF_GROUP_NAME); return hzlCfg; }
public com.hazelcast.config.Config getHazelcastConfig() { System.setProperty("hazelcast.logging.type", "slf4j"); com.hazelcast.config.Config hzlCfg = new ClasspathXmlConfig(getHazelcastConfigFile()); hzlCfg.getGroupConfig().setName(HAZELCAST_FF_GROUP_NAME); return hzlCfg; }
/** * <P> * Create a Jet instance, which in turn will create a Hazelcast IMDG instance. * Use the supplied IMDG configuration but let the Jet configuration be the * default. * </P> * * @return Hazelcast Jet instance */ @Bean public JetInstance jetInstance() { Config imdgConfig = new ClasspathXmlConfig("hazelcast.xml"); JetConfig jetConfig = new JetConfig().setHazelcastConfig(imdgConfig); return Jet.newJetInstance(jetConfig); }
private Config createConfig( HazelcastEntityStoreConfiguration configuration ) throws IOException { String hzConfLocation = configuration.configXmlLocation().get(); if( hzConfLocation == null || hzConfLocation.isEmpty() ) { hzConfLocation = "hazelcast-default.xml"; } Config conf; if( hzConfLocation.contains( ":" ) ) { conf = new UrlXmlConfig( hzConfLocation ); } else { conf = new ClasspathXmlConfig( hzConfLocation ); } return conf; } }
String resource = args[i]; try { hConfig = new ClasspathXmlConfig(resource); } catch (Exception e) { fut.handle(Future.failedFuture(CANNOT_LOAD_STR + resource + ": " + e));
/** * Load Hazelcast configuration from the standard * file "{@code hazelcast.xml}" then extend it with * the custom service. * * @return Configuration to build a Hazelcast server */ @Bean public Config config() { Config config = new ClasspathXmlConfig("hazelcast.xml"); // Record the custom service class ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setEnabled(true); serviceConfig.setName(MyPriorityQueueService.class.getSimpleName()); serviceConfig.setClassName(MyPriorityQueueService.class.getName()); // Add it to overall config config.getServicesConfig().addServiceConfig(serviceConfig); return config; }