[英]Is there any way to shut down a Hazelcast instance in a JVM?
My Java code started numbers of Hazelcast instances in the same JVM (but they are in the same group). 我的Java代码在同一个JVM中启动了许多Hazelcast实例(但它们属于同一组)。
Now I want to shut down some of instances, but not all of them. 现在我想关闭一些实例,但不是所有实例。
I know the method Hazelcast.shutdownAll()
- this method closes all of the instances. 我知道方法
Hazelcast.shutdownAll()
- 这个方法关闭所有实例。 Is there a method that allows to close a specific instance? 有没有一种方法可以关闭特定的实例?
It's very easy - here is the code: 这很容易 - 这是代码:
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
instance.getLifecycleService().shutdown();
That is correct. 那是正确的。
Depending on the Hazelcast version, you can also call hazelcastInstance.shutdown()
. 根据Hazelcast版本,您还可以调用
hazelcastInstance.shutdown()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.