Hi Barry, Thanks for the response.
I am actually calling region.close() which I believe calls localDestroyRegion only. The problem is region names are same in both cluster so do how do I close region of cluster before switching to another cluster. I just want to switch pools based upon my use case at run-time. With best regards, Ashish On Tue, May 5, 2020, 10:25 PM Barry Oglesby <[email protected]> wrote: > Ashish, > > You're probably using region.destroyRegion to destroy the client region. > If so, that also destroys the region on the server. > > You should be able to use localDestroyRegion to just destroy the client > region like: > > // Get the region's key set using pool 1 > Region pool11Region = createRegion(this.pool1.getName()); > Set pool1Keys = pool1Region.keySetOnServer(); > pool1Region.localDestroyRegion(); > > // Get the region's key set using pool 2 > Region pool2Region = createRegion(this.pool2.getName()); > Set pool2Keys = pool2Region.keySetOnServer(); > pool2Region.localDestroyRegion(); > > The createRegion method is: > > private Region createRegion(String poolName) { > return this.cache > .createClientRegionFactory(ClientRegionShortcut.PROXY) > .setPoolName(poolName) > .create(this.regionName); > } > > Thanks, > Barry Oglesby > > > > On Tue, May 5, 2020 at 9:37 AM aashish choudhary < > [email protected]> wrote: > >> Hi, >> >> I am sort of trying to implement a failover/failback for geode client. I >> have followed the approach the mentioned in here >> <https://community.pivotal.io/s/article/Configure-client-to-use-several-clusters>. >> I understand it's for gemfire but sharing just for reference as the use >> case is same and will apply this for geode as well. I hope that's ok. >> >> This is what i am trying to do. Creating two pools but in my case i have >> same region names in both cluster A and B. >> ClientCache clientCache = new ClientCacheFactory().create(); >> >> PoolFactory poolFactory = PoolManager.createFactory(); >> poolFactory.addLocator("Locator1", 10334); >> poolFactory.addLocator("Locator2", 10334); >> poolFactory.create("A"); >> >> poolFactory = PoolManager.createFactory(); >> poolFactory.addLocator("Locator1", 10334); >> poolFactory.addLocator("Locator2", 10334); >> poolFactory.create("B"); >> >> Region region11 = >> clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY) >> .setPoolName("A") >> .create("region1"); >> >> Region region22 = >> clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY) >> .setPoolName("A") >> .create("region2"); >> >> >> >> Region region33 = >> clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY) >> .setPoolName("B") >> >> .create("region1"); >> >> Region region44 = >> clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY) >> .setPoolName("B") >> >> .create("region2"); >> >> So If a client needs to connect to regions with the same name in two >> different distributed systems then it must close or destroy the region and >> recreate it with the changed pool configuration each time it wants to change >> between two distributed systems. >> >> I am doing the same but getting region destroyed exception instead. I am >> using geode java client not spring data geode. >> >> How to do this? Please help. >> >> >> >> With Best Regards, >> Ashish >> >
