本文整理了Java中com.hazelcast.core.Hazelcast.newHazelcastInstance()
方法的一些代码示例,展示了Hazelcast.newHazelcastInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hazelcast.newHazelcastInstance()
方法的具体详情如下:
包路径:com.hazelcast.core.Hazelcast
类名称:Hazelcast
方法名:newHazelcastInstance
[英]Creates a new HazelcastInstance (a new node in a cluster). This method allows you to create and run multiple instances of Hazelcast cluster members on the same JVM.
To shutdown all running HazelcastInstances (all members on this JVM) call #shutdownAll(). Hazelcast will look into two places for the configuration file:
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, String> map = hz.getMap("map");
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, String> map = hz.getMap("map");
map.put("1", "Tokyo");
map.put("2", "Paris");
map.put("3", "New York");
System.out.println("Finished loading map");
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("foo", new Person("foo"));
System.out.println("finished writing");
System.out.println(map.get("foo"));
System.out.println("finished reading");
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
ISet<String> set = hz.getSet("set");
for (String s : set) {
System.out.println(s);
}
System.out.println("Reading finished!");
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) throws Exception {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
IQueue<String> queue = hz.getQueue("q");
System.out.println("Queue retrieved: " + queue);
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
IList<String> list = hz.getList("list");
for (String s : list) {
System.out.println(s);
}
System.out.println("Reading finished!");
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<String, Person> map = hz.getMap("map");
map.put("Peter", new Person("Peter"));
Person person = map.get("Peter");
System.out.println(person);
Hazelcast.shutdownAll();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(newConfig());
Map<String, String> map = hazelcastInstance.getMap("map");
map.put("1", "Tokyo");
map.put("2", "Paris");
map.put("3", "New York");
System.out.println("Inserted " + map.size() + " entries into maps hd memory");
hazelcastInstance.shutdown();
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
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();
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
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();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
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();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
ITopic<Date> topic = hz.getTopic("topic");
topic.publish(new Date());
System.out.println("Published");
System.exit(0);
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
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();
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
IMap<String, String> map = hz.getMap("someMap");
map.addEntryListener(new MyEntryListener(), true);
System.out.println("EntryListener registered");
}
内容来源于网络,如有侵权,请联系作者删除!