本文整理了Java中com.hazelcast.core.Hazelcast.getOrCreateHazelcastInstance()
方法的一些代码示例,展示了Hazelcast.getOrCreateHazelcastInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hazelcast.getOrCreateHazelcastInstance()
方法的具体详情如下:
包路径:com.hazelcast.core.Hazelcast
类名称:Hazelcast
方法名:getOrCreateHazelcastInstance
[英]Gets or creates a HazelcastInstance with the default XML configuration looked up in:
代码示例来源:origin: org.jnosql.diana/hazelcast-driver
/**
* Creates a {@link HazelcastBucketManagerFactory} from hazelcast config
* @param config the {@link Config}
* @return the HazelCastBucketManagerFactory instance
* @throws NullPointerException when config is null
*/
public HazelcastBucketManagerFactory get(Config config)throws NullPointerException {
requireNonNull(config, "config is required");
HazelcastInstance hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
return new DefaultHazelcastBucketManagerFactory(hazelcastInstance);
}
代码示例来源:origin: org.jnosql.diana/hazelcast-driver
/**
* Creates a {@link HazelcastBucketManagerFactory} from configuration map
* @param configurations the configuration map
* @return the HazelCastBucketManagerFactory instance
* @throws NullPointerException when configurations is null
*/
public HazelcastBucketManagerFactory get(Map<String, String> configurations) throws NullPointerException {
List<String> servers = configurations.keySet().stream().filter(s -> s.startsWith("hazelcast-hoster-"))
.collect(Collectors.toList());
Config config = new Config(configurations.getOrDefault("hazelcast-instanceName", "hazelcast-instanceName"));
HazelcastInstance hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
return new DefaultHazelcastBucketManagerFactory(hazelcastInstance);
}
代码示例来源:origin: vgoldin/cqrs-eventsourcing-kafka
public static HazelcastInstance getInstance() {
if (hazelcastInstance == null) {
Config config = new XmlConfigBuilder().build();
config.setInstanceName(Thread.currentThread().getName());
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
}
return hazelcastInstance;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private HazelcastInstance getDefaultInstance() {
if (hazelcastInstance == null) {
// if there is no default instance in use (not created yet and not specified):
// 1. locate default ClientConfig: if it specifies an instance name, get-or-create an instance by that name
// 2. otherwise start a new Hazelcast member
Config config = getDefaultConfig();
if (isNullOrEmptyAfterTrim(config.getInstanceName())) {
hazelcastInstance = Hazelcast.newHazelcastInstance();
} else {
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
}
}
return hazelcastInstance;
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private HazelcastInstance getDefaultInstance() {
if (hazelcastInstance == null) {
// if there is no default instance in use (not created yet and not specified):
// 1. locate default ClientConfig: if it specifies an instance name, get-or-create an instance by that name
// 2. otherwise start a new Hazelcast member
Config config = getDefaultConfig();
if (isNullOrEmptyAfterTrim(config.getInstanceName())) {
hazelcastInstance = Hazelcast.newHazelcastInstance();
} else {
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
}
}
return hazelcastInstance;
}
代码示例来源: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: com.hazelcast/jetty-core
/**
* Create hazelcast full instance.
*
* @param configLocation the config location
* @return the hazelcast instance
*/
public static HazelcastInstance createHazelcastFullInstance(String configLocation) {
Config config;
try {
if (configLocation == null) {
config = new XmlConfigBuilder().build();
} else {
config = ConfigLoader.load(configLocation);
}
} catch (IOException e) {
throw new RuntimeException("failed to load config", e);
}
checkNotNull(config, "failed to find configLocation: " + configLocation);
config.setInstanceName(DEFAULT_INSTANCE_NAME);
return Hazelcast.getOrCreateHazelcastInstance(config);
}
}
代码示例来源:origin: org.apache.camel/camel-hazelcast
} else if (config != null) {
if (ObjectHelper.isNotEmpty(config.getInstanceName())) {
hzInstance = Hazelcast.getOrCreateHazelcastInstance(config);
} else {
hzInstance = Hazelcast.newHazelcastInstance(config);
代码示例来源:origin: com.intrbiz.balsa/balsa-hazelcast
this.hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(this.hazelcastConfig);
代码示例来源:origin: com.intrbiz.balsa/balsa-hazelcast
this.hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(this.hazelcastConfig);
代码示例来源:origin: org.wso2.siddhi/siddhi-extension-event-table
return Hazelcast.getOrCreateHazelcastInstance(config);
} else {
ClientConfig clientConfig = new ClientConfig();
代码示例来源:origin: com.intrbiz.util/cache-hazelcast
this.hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
代码示例来源:origin: org.eclipse.jetty/jetty-hazelcast
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance( config );
内容来源于网络,如有侵权,请联系作者删除!