[infinispan-dev] How to terminate Infinispan instance in the distributed mode?

Liguangpeng (Roc, IPTechnologyResearchDept&HW) liguangpeng at huawei.com
Tue May 13 05:36:27 EDT 2014


Hello Infinispan experts,

I want to create a cluster of Infinispan which consist of multiple nodes. Then I expect to control the number of instances, so I want some nodes to quid gracefully. After reading the documents, I try cache.stop() to do so. But It seems not work, my application embedded with Infinispan does not terminated. Following is my sample code and result. Please point my mistake if I have. If this is not proper list, please tell me the right one. Thank you very much.

Sample code:
public static void main(String[] args) {
    test0();
}
public static void test0() {
        EmbeddedCacheManager manager = new DefaultCacheManager(
                GlobalConfigurationBuilder.defaultClusteredBuilder()
                        .transport().addProperty("configurationFile", "jgroups-tcp-x.xml")
                        .globalJmxStatistics().allowDuplicateDomains(true)
                        .build(),
                new ConfigurationBuilder()
                        .clustering()
                        .cacheMode(CacheMode.DIST_ASYNC)
                        .hash().numOwners(1)
                        .build()
        );
        Cache<String, String> myCache = manager.getCache("mycache");
        System.out.println("Cache instance started!");
        myCache.stop();
        System.out.println("Cache instance stopped!");
}

Result:
Cache instance started!
Cache instance stopped!
I expected the program terminates here, but it doesn't.

Best Regards,
Roc Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20140513/f9762e73/attachment-0001.html 


More information about the infinispan-dev mailing list