/** * Hazelcast config config. * * @return the config */ @Bean public Config hazelcastConfig() { return new Config().setProperty("hazelcast.jmx", "true") .addMapConfig(new MapConfig("spring-boot-admin-application-store").setBackupCount(1) .setEvictionPolicy(EvictionPolicy.NONE)) .addListConfig(new ListConfig("spring-boot-admin-event-store").setBackupCount(1) .setMaxSize(1000)); }
.setProperty("hazelcast.tcp.join.port.try.count", "10") .setProperty("hazelcast.socket.bind.any", "false") .setProperty("hazelcast.phone.home.enabled", "false") .setProperty("hazelcast.logging.type", "slf4j");
Config config = new Config(); config.setProperty("hazelcast.initial.min.cluster.size","3");
@Bean public HazelcastInstance hazelcastInstance() { return Hazelcast.newHazelcastInstance(new Config().setProperty("hazelcast.logging.type", "slf4j")); }
/** * Override properties. * * @param config */ public static void performPropertyOverrides(Config config) { config.setProperty(GroupProperties.PROP_LOGGING_TYPE, "log4j2"); config.setProperty(GroupProperties.PROP_REST_ENABLED, "true"); config.setProperty(GroupProperties.PROP_SHUTDOWNHOOK_ENABLED, "false"); }
@Override public Config setProperty(String name, String value) { return staticConfig.setProperty(name, value); }
@Override public Config setProperty(String name, String value) { return staticConfig.setProperty(name, value); }
public static HazelcastInstance newInstance() { Config cfg = new XmlConfigBuilder().build(); // hazelcast.version.check.enabled is deprecated cfg.setProperty( "hazelcast.phone.home.enabled", System.getProperty("hazelcast.phone.home.enabled", "false") ); cfg.setProperty( "hazelcast.logging.type", System.getProperty("hazelcast.logging.type", "slf4j") ); return newInstance(cfg); }
public static void main(String[] args) throws Exception { Config config = new Config(); config.setProperty("hazelcast.rest.enabled", "true"); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); Person person = new Person("Joe"); IMap<String, String> hzSimpleMap = hz.getMap("simple"); hzSimpleMap.set("key1", "value1"); IMap<String, Person> hzObjectMap = hz.getMap("object"); hzObjectMap.set("key1", person); } }
protected static Config newProgrammaticConfig() { Config config = new Config(); config.setProperty("hazelcast.merge.first.run.delay.seconds", "5"); config.setProperty("hazelcast.merge.next.run.delay.seconds", "3"); config.getGroupConfig().setName(generateRandomString(10)); return config; }
public static void main(String[] args) { Config config = new Config(); config.setProperty("hazelcast.map.entry.filtering.natural.event.types", "true"); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); IMap<String, String> map = hz.getMap("map"); map.addEntryListener(new MyEntryListener(), new SqlPredicate("name=peter"), true); System.out.println("EntryListener registered"); }
public static void applyMetricsConfig(Config hzConfig, MetricsConfig metricsConfig) { if (metricsConfig.isEnabled()) { hzConfig.setProperty(Diagnostics.METRICS_LEVEL.getName(), ProbeLevel.INFO.name()); if (metricsConfig.isMetricsForDataStructuresEnabled()) { hzConfig.setProperty(Diagnostics.METRICS_DISTRIBUTED_DATASTRUCTURES.getName(), "true"); } } }
protected static Config newDeclarativeConfig() { try { Config config = new XmlConfigBuilder("src/main/resources/hazelcast-splitbrain.xml").build(); config.setProperty("hazelcast.merge.first.run.delay.seconds", "5"); config.setProperty("hazelcast.merge.next.run.delay.seconds", "3"); config.getGroupConfig().setName(generateRandomString(10)); return config; } catch (FileNotFoundException e) { throw ExceptionUtil.rethrow(e); } }
/** * Configure a connection as a cluster node. * * @return ClientConfig */ private com.hazelcast.config.Config loadConfig() throws Exception { final String configFile = config.getString("server.hazelcast.config"); final com.hazelcast.config.Config config = new XmlConfigBuilder( configFile ).build(); config.setProperty( "hazelcast.logging.type", "slf4j" ); return config; } }
Config config = new Config(); config.setProperty("hazelcast.shutdownhook.enabled", "false"); NetworkConfig network = config.getNetworkConfig(); network.getJoin().getTcpIpConfig().setEnabled(false); network.getJoin().getMulticastConfig().setEnabled(false); HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
private Config createConfig() { return new Config() .setProperty("hazelcast.wait.seconds.before.join", "0") .setProperty("hazelcast.local.localAddress", "127.0.0.1") .setGroupConfig(new GroupConfig() .setName(System.getProperty("vertx.hazelcast.test.group.name")) .setPassword(System.getProperty("vertx.hazelcast.test.group.password"))); }
private static Config createConfig() { Config config = new Config(); config.setLicenseKey(ENTERPRISE_LICENSE_KEY); config.setProperty("hazelcast.wait.seconds.before.join", "0"); SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig(); interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName()); config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig); return config; }
private static Config createConfig() { Config config = new Config(); config.setLicenseKey(ENTERPRISE_LICENSE_KEY); config.setProperty("hazelcast.wait.seconds.before.join", "0"); SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig(); interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName()); config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig); return config; }
private static Config createConfig() { Config config = new Config(); config.setLicenseKey(ENTERPRISE_LICENSE_KEY); config.setProperty("hazelcast.wait.seconds.before.join", "0"); SecurityInterceptorConfig securityInterceptorConfig = new SecurityInterceptorConfig(); securityInterceptorConfig.setClassName(MySecurityInterceptor.class.getName()); SecurityConfig securityConfig = config.getSecurityConfig(); securityConfig.setEnabled(true).addSecurityInterceptorConfig(securityInterceptorConfig); // when you enable security all client requests are denied, so we need to give permission first // security-interceptor will be run after checking this permission PermissionConfig permissionConfig = new PermissionConfig(PermissionConfig.PermissionType.ALL, "", null); securityConfig.addClientPermissionConfig(permissionConfig); return config; }
static HazelcastInstance newStandaloneHazelcastInstance() { Config config = new Config(); config.setProperty("hazelcast.logging.type", "slf4j"); config.setProperty("hazelcast.shutdownhook.enabled", "false"); NetworkConfig network = config.getNetworkConfig(); network.getJoin().getTcpIpConfig().setEnabled(false); network.getJoin().getMulticastConfig().setEnabled(false); return Hazelcast.newHazelcastInstance(config); } }