@Override public void close() { try { hzInstance.shutdown(); } catch (HazelcastInstanceNotActiveException e) { LoggerFactory.getLogger(getClass()).debug("Unable to shutdown Hazelcast member", e); } } }
@Override public void close(Throwable error) { if (client != null) { client.shutdown(); } }
private void shutdownHazelcastInstance() { HazelcastInstance localInstanceRef = hazelcastInstance; if (localInstanceRef != null) { localInstanceRef.shutdown(); } hazelcastInstance = null; }
@Override public void close() { if (client != null) { client.shutdown(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<Long, Person> personMap = hz.getMap("personMap"); Person p = personMap.get(1L); System.out.println(p); hz.shutdown(); } }
public static void main(String[] args) { HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(newConfig()); Map<String, String> map = hazelcastInstance.getMap("map"); for (int i = 0; i < 10 * MAX_ENTRY_COUNT; i++) { map.put("key-" + i, "value-" + i); } System.out.println("Map size is " + map.size() + " and it is below the allowed max entry count " + MAX_ENTRY_COUNT); hazelcastInstance.shutdown(); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, String> map = hz.getReplicatedMap("map"); map.put("1", "Tokyo"); map.put("2", "Paris"); map.put("3", "New York"); System.out.println("Finished loading map"); hz.shutdown(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, String> map = hz.getReplicatedMap("map"); for (Map.Entry<String, String> entry : map.entrySet()) { System.out.println(entry.getKey() + " " + entry.getValue()); } hz.shutdown(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<Long, Person> personMap = hz.getMap("personMap"); personMap.put(1L, new Person(1L, "Peter")); hz.shutdown(); } }
static void destroy() { if (cacheManager != null) { Iterable<String> cacheNames = cacheManager.getCacheNames(); for (String name : cacheNames) { cacheManager.destroyCache(name); } } if (instance != null) { instance.shutdown(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); ReplicatedMap<String, String> map = hz.getReplicatedMap("somemap"); String key = "" + System.nanoTime(); String value = "1"; map.put(key, value); map.put(key, "2"); map.remove(key); hz.shutdown(); } }
@Override public void init(@Nonnull Context context) { HazelcastInstance client = newHazelcastClient(asClientConfig(clientXml)); try { HazelcastClientProxy clientProxy = (HazelcastClientProxy) client; remotePartitionCount = clientProxy.client.getClientPartitionService().getPartitionCount(); } finally { client.shutdown(); } }
public static void main(String[] args) { Config config = new Config(); config.getSerializationConfig() .addPortableFactory(SamplePortableFactory.FACTORY_ID, new SamplePortableFactory()); // Start the Embedded Hazelcast Cluster Member. HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); //Customer can be used here hz.shutdown(); } }
public static void main(String[] args) { Config config = new Config(); config.getSerializationConfig() .addDataSerializableFactory(SampleDataSerializableFactory.FACTORY_ID, new SampleDataSerializableFactory()); // Start the Embedded Hazelcast Cluster Member. HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); //Employee can be used here hz.shutdown(); } }
private void initRemote() { HazelcastInstance client = newHazelcastClient(asClientConfig(clientXml)); try { HazelcastClientProxy clientProxy = (HazelcastClientProxy) client; remotePartitionCount = clientProxy.client.getClientPartitionService().getPartitionCount(); } finally { client.shutdown(); } }
public static void main(String[] args) { Config config = new Config(); config.getSerializationConfig().addSerializerConfig(new SerializerConfig() .setImplementation(new CustomSerializer()) .setTypeClass(CustomSerializable.class)); // Start the Embedded Hazelcast Cluster Member. HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); //CustomSerializer will serialize/deserialize CustomSerializable objects hz.shutdown(); } }
public static void main(String[] args) { ClientConfig clientConfig = new ClientConfig(); clientConfig.getSerializationConfig().addSerializerConfig(new SerializerConfig() .setImplementation(new CustomSerializer()) .setTypeClass(CustomSerializable.class)); // Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1 HazelcastInstance hz = HazelcastClient.newHazelcastClient(clientConfig); //CustomSerializer will serialize/deserialize CustomSerializable objects hz.shutdown(); } }