infinispanhot-rod

Hot rod java client removeCache (replicated cache)


I'm in this situation: I have an Infinispan cluster (12.1) with two nodes and a replicated cache configured via xml. I have also an hot rod client and when I try to call removeCache method, the first time, the cache is not removed but if I try a second one call to removeCache, the cache is deleted correctly. I need a correctly removal at the first attempt.

Can anyone help me?


Solution

  • If you know beforehand you may need to remove caches, it's best to create them with CacheContainerAdmin.createCache() (or via the REST API/CLI/console) instead of the server XML configuration.

    CacheContainerAdmin.removeCache() is under-specified: the javadoc doesn't say what it does when the cache was not created with CacheContainerAdmin.createCache(). As you've discovered, the current implementation only removes the cache on the server that processed the client request.

    I have created ISPN-13048 to improve the documentation and maybe change the behaviour.