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