public static HazelcastInstance findSystemInstance() { String instance_name; String sys_instance = System.getProperty(pn_node_instance); if (sys_instance == null) { instance_name = hz_instance; } else { instance_name = hz_instance + "-" + sys_instance; } HazelcastInstance result = Hazelcast.getHazelcastInstanceByName(instance_name); if (result == null) { logger.warn("findSystemInstance; cannot find HZ for name: {}", instance_name); } return result; }
@Override public HazelcastInstance loadInstance() throws CacheException { if (existingInstanceName != null) { instance = Hazelcast.getHazelcastInstanceByName(existingInstanceName); if (instance == null) { throw new CacheException("No instance with name [" + existingInstanceName + "] could be found."); } } else { instance = Hazelcast.newHazelcastInstance(config); } return instance; }
/** * Destroys currently allocated instance. */ public void destroy() { log.info("Shutting down Hazelcast instance [{}]..", hcInstanceName); final HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName( hcInstanceName); if (instance != null) { instance.shutdown(); } }
public static CacheManager getCacheManager(String uriString, Properties properties) { String instanceName = properties.getProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME); if (instanceName == null) { throw new IllegalStateException("Either instance-ref' attribute or " + HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME + " property is required for creating cache manager"); } return getCacheManager(Hazelcast.getHazelcastInstanceByName(instanceName), uriString, properties); } }
@Override public HazelcastInstance loadInstance() throws CacheException { if (existingInstanceName != null) { instance = Hazelcast.getHazelcastInstanceByName(existingInstanceName); if (instance == null) { throw new CacheException("No instance with name [" + existingInstanceName + "] could be found."); } } else { instance = Hazelcast.newHazelcastInstance(config); } return instance; }
@Override public HazelcastInstance loadInstance() throws CacheException { if (existingInstanceName != null) { instance = Hazelcast.getHazelcastInstanceByName(existingInstanceName); if (instance == null) { throw new CacheException("No instance with name [" + existingInstanceName + "] could be found."); } } else { instance = Hazelcast.newHazelcastInstance(config); } return instance; }
public static CacheManager getCacheManager(String uriString, Properties properties) { String instanceName = properties.getProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME); if (instanceName == null) { throw new IllegalStateException("Either instance-ref' attribute or " + HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME + " property is required for creating cache manager"); } return getCacheManager(Hazelcast.getHazelcastInstanceByName(instanceName), uriString, properties); } }
public static CacheManager getCacheManager(String uriString, Properties properties) { String instanceName = properties.getProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME); if (instanceName == null) { throw new IllegalStateException("Either instance-ref' attribute or " + HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME + " property is required for creating cache manager"); } return getCacheManager(Hazelcast.getHazelcastInstanceByName(instanceName), uriString, properties); } }
@Override public HazelcastInstance loadInstance() throws CacheException { if (existingInstanceName != null) { instance = Hazelcast.getHazelcastInstanceByName(existingInstanceName); if (instance == null) { throw new CacheException("No instance with name [" + existingInstanceName + "] could be found."); } } else { instance = Hazelcast.newHazelcastInstance(config); } return instance; }
private static HazelcastInstance loadExistingInstance(ClusteredSessionService sessionService, String instanceName) throws ServletException { LOGGER.info("Using existing Hazelcast instance with name [" + instanceName + "] for session replication"); HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(instanceName); if (instance == null) { throw new ServletException("Hazelcast instance with name [" + instanceName + "] could not be found."); } instance.getLifecycleService().addLifecycleListener(new ClientLifecycleListener(sessionService)); return instance; }
private static HazelcastInstance loadExistingInstance(ClusteredSessionService sessionService, String instanceName) throws ServletException { LOGGER.info("Using existing Hazelcast instance with name [" + instanceName + "] for session replication"); HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(instanceName); if (instance == null) { throw new ServletException("Hazelcast instance with name [" + instanceName + "] could not be found."); } instance.getLifecycleService().addLifecycleListener(new ClientLifecycleListener(sessionService)); return instance; }
public static HazelcastInstance findSchemaInstance(String schemaName) { // do we need synchronize this block? if (node_instance == null) { HazelcastInstance hzInstance = findSystemInstance(); node_instance = ((Member) hzInstance.getLocalEndpoint()).getStringAttribute(pn_node_instance); } return Hazelcast.getHazelcastInstanceByName(schemaName + "-" + node_instance); }
/** * Gets an existing {@link HazelcastInstance} by {@code instanceName} or, * if not found, creates a new {@link HazelcastInstance} with the default * configuration and given {@code instanceName}. * * @param instanceName name to lookup an existing {@link HazelcastInstance} * or to create a new one * @return a {@link HazelcastInstance} with the given {@code instanceName} */ private HazelcastInstance getOrCreateByInstanceName(String instanceName) { HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(instanceName); if (instance == null) { Config config = getDefaultConfig(); config.setInstanceName(instanceName); instance = Hazelcast.getOrCreateHazelcastInstance(config); } return instance; }
/** * Gets an existing {@link HazelcastInstance} by {@code instanceName} or, * if not found, creates a new {@link HazelcastInstance} with the default * configuration and given {@code instanceName}. * * @param instanceName name to lookup an existing {@link HazelcastInstance} * or to create a new one * @return a {@link HazelcastInstance} with the given {@code instanceName} */ private HazelcastInstance getOrCreateByInstanceName(String instanceName) { HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(instanceName); if (instance == null) { Config config = getDefaultConfig(); config.setInstanceName(instanceName); instance = Hazelcast.getOrCreateHazelcastInstance(config); } return instance; }
hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM));
hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM));
HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(hazelcastInstanceName); if (instance != null) {
hcInstance = Hazelcast.getHazelcastInstanceByName(getNodeName()); if (hcInstance != null) { return hcInstance;