1 Reply Latest reply on Apr 17, 2012 4:03 AM by galder.zamarreno

    cache manager stop exception and how to check if the CacheManager is completely stopped

    dex80526

      Hi, all:

       

      Configuration: ISPN 5.1.3 FINAL and use FileCacheStore in replication mode.

       

      Note: I am aware of FileCacheStore's limitation.

      In my case, I just have a few tokens need to be replicated and persisted to the store.

       

      I have a user case which needs to dynamically start and stop/destroy a cache manager and restart start one if the configuration changes.

       

      I have the following logic:

      if config is new or changed,

           stop and destroy exsitng cache manger instance if exists

          create a new cache manager with the new configuration and start it

      else

         do nothing.

       

      In some cases, the underline storage is on NFS/CIFS share, and they could be un-mount and re-mount with new configuration.  Hence, my cache manager service (which handles cache manager creation/start/stop/destroy) is dependent on the storage service. I ensure to start/stop order of the dependncy in the code.

       

      In my testing, I see the following exceptions when change the configuration:

      ....

      2012-04-16/11:07:47.620/MDT [pool-2-thread-2] ERROR org.infinispan.loaders.file.FileCacheStore[592] - ISPN000151: Error flushing to file: sun.nio.ch.FileChannelImpl@479a1160

      java.io.IOException: No such device

              at sun.nio.ch.FileDispatcherImpl.force0(Native Method)

              at sun.nio.ch.FileDispatcherImpl.force(FileDispatcherImpl.java:75)

              at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:363)

              at org.infinispan.loaders.file.FileCacheStore$BufferedFileSync.stop(FileCacheStore.java:590)

              at org.infinispan.loaders.file.FileCacheStore.stop(FileCacheStore.java:392)

              at org.infinispan.loaders.decorators.AbstractDelegatingStore.stop(AbstractDelegatingStore.java:138)

              at org.infinispan.loaders.decorators.AsyncStore.stop(AsyncStore.java:236)

              at org.infinispan.loaders.CacheLoaderManagerImpl.stop(CacheLoaderManagerImpl.java:211)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:236)

              at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:882)

              at org.infinispan.factories.AbstractComponentRegistry.internalStop(AbstractComponentRegistry.java:672)

              at org.infinispan.factories.AbstractComponentRegistry.stop(AbstractComponentRegistry.java:551)

              at org.infinispan.factories.ComponentRegistry.stop(ComponentRegistry.java:198)

              at org.infinispan.CacheImpl.stop(CacheImpl.java:516)

              at org.infinispan.CacheImpl.stop(CacheImpl.java:508)

              at org.infinispan.manager.DefaultCacheManager.stop(DefaultCacheManager.java:739)

       

      I am assuming the exception is caused by the storage share is not availble.  But, my code ensure the cache manger's stop() is called before storage share could be changed/un-mounted.

       

      Hence, here is my question, is the cache manager stop() method is synchronous or asynchronous?  if asynchronous, how should I check to ensure the cache manager is completely stopped?