3 Replies Latest reply on Aug 26, 2014 11:46 PM by Phillip Atkinson

    Best practices for start() and stop() ?

    Phillip Atkinson Newbie

      Hi,

       

      I'm wondering what the best practices for using the start() and stop() methods are for a Cache / CacheManager ?

       

      For example, in my app which uses several named caches, on startup every node does something like this:

       

      CacheContainer cacheManager = new DefaultCacheManager(config.xml);

      cacheManager.getCache("cache1").start();

      cacheManager.getCache("cache2").start();

       

      Is this correct / ok?

       

      Then when a node shuts down, I'm not sure if that particular node needs to call cacheManager.stop() -> this would stop the cacheManager, also stopping all caches ? Should every node in a cluster do this when it shuts down (to gracefully stop any in-process data replication, etc), or is it not necessary?