Can you check whether there is any call to cache.stop() in the code? If you call stop() on cache or cacheContainer and try to access the cache, you will get this error.
If the cache is part of web application, make sure to call cacheContainer.stop() while un-deploying the webapp.
Thanks Pisa. I'll look into this.
A related question about start/stop cahces: Do I need to call start() on cache manager first to call startCache(s) for named caches? Or do I need to call startCache(s) after call start() on cacheManager? Right now, it seems that calling start() on cacheManager is not required if startCache() method is called.
It's best if you call start() on the cache manager first, or you create the cache manager with a constructor which already starts the cache manager (maybe you already do this...)
Galder, thanks for the response.
I am trying to use start() on cacheManager right now.
It seems that the method startCaches( String ...) may have potential issues when you have many named caches configured. The issue ("Unable to aquire lock..) I ran into may be related to this method. I used the startCaches( ..) in my earlier code.
Right now, what I am doing is that I create a DefaultCacheManager, and call start() on the cacheManager. I do not call startCache() or startCaches() on named caches, since all defined caches in the same cache manager have the same life cycle.
I am testing these changes now.
Do you see any problems?
No, that shouldn't be a problem. startCaches() is just a way to start caches in advance, but you can get the same effect calling getCache() on each cache when necessary.
I'm interested though in the "Unable to aquire lock.." issue. Do you have a unit test for this?
No, I do not have a unit test to recreat "Unable to acquire lock" yet. I'll try to create one. Right now, I ran into many other issues (as posted separately), and try to work around of them. I am thinking the startCaches(list of cache names) method behaves differently. The code seems putting starting each cache in a separate thread. thanks.