com.hazelcast.core.Hazelcast.getHazelcastInstanceByName()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中com.hazelcast.core.Hazelcast.getHazelcastInstanceByName()方法的一些代码示例,展示了Hazelcast.getHazelcastInstanceByName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hazelcast.getHazelcastInstanceByName()方法的具体详情如下:
包路径:com.hazelcast.core.Hazelcast
类名称:Hazelcast
方法名:getHazelcastInstanceByName

Hazelcast.getHazelcastInstanceByName介绍

[英]Returns an existing HazelcastInstance with instanceName.

To shutdown all running HazelcastInstances (all members on this JVM) call #shutdownAll().
[中]返回instanceName为的现有HazelcastInstance。
要关闭所有正在运行的HazelcastInstances(此JVM上的所有成员),请调用#shutdownAll()。

代码示例

代码示例来源:origin: dsukhoroslov/bagri

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; 
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@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;
}

代码示例来源:origin: orientechnologies/spring-data-orientdb

/**
 * 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();
  }
}

代码示例来源:origin: com.hazelcast.jet/hazelcast-jet-spring

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);
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-hibernate5

@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;
}

代码示例来源:origin: com.hazelcast/hazelcast-hibernate52

@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;
}

代码示例来源:origin: hazelcast/hazelcast-jet

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);
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

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);
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-hibernate4

@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;
}

代码示例来源:origin: com.hazelcast/hazelcast-wm

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;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

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;
}

代码示例来源:origin: dsukhoroslov/bagri

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);
}

代码示例来源:origin: hazelcast/hazelcast-jet

/**
 * 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;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

/**
 * 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;
}

代码示例来源:origin: org.apache.camel/camel-hazelcast

hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM));

代码示例来源:origin: org.apache.camel/camel-hazelcast

hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM));

代码示例来源:origin: wso2/wso2-synapse

HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(hazelcastInstanceName);
if (instance != null) {

代码示例来源:origin: com.erudika/para

hcInstance = Hazelcast.getHazelcastInstanceByName(getNodeName());
if (hcInstance != null) {
  return hcInstance;

相关文章