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

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


Yes, this works fine for me. Thank you very much.

Roc Lee

> -----Original Message-----
> From: infinispan-dev-bounces at lists.jboss.org
> [mailto:infinispan-dev-bounces at lists.jboss.org] On Behalf Of Sanne Grinovero
> Sent: Tuesday, May 13, 2014 5:40 PM
> To: infinispan -Dev List
> Subject: Re: [infinispan-dev] How to terminate Infinispan instance in the
> distributed mode?
> 
> Hi,
> you'll have to stop che CacheManager:
> 
> manager.stop();
> 
> On 13 May 2014 10:36, Liguangpeng (Roc, IPTechnologyResearchDept&HW)
> <liguangpeng at huawei.com> wrote:
> > 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
> >
> >
> > _______________________________________________
> > infinispan-dev mailing list
> > infinispan-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/infinispan-dev
> 
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev



More information about the infinispan-dev mailing list