Multiple instances of the same enterprise application in a WebSphere container process messages read from a queue simultaneously. The application has a shared EhCacheManager. As the consequence of an Exception in a single application instance, Spring shuts down the shared EhCacheManager as follows:
org.springframework.cache.ehcache.EhCacheManagerFactoryBean destroy Shutting down EHCache CacheManager
Other application instances running fine at the same time are impacted by the shut down cache manager:
java.lang.IllegalStateException: The myCache Cache is not alive (STATUS_SHUTDOWN)
How should one avoid Spring shutdown of a shared EhCacheManager when an application instance is destroyed due to failure while other instances are using it? I am happy to use different solutions such as a non shared EhCacheManager but I failed because I don't know how to dynamically assign unique cache names for each application instance.
<bean
id="ehCacheManager"
scope="singleton"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="shared" value="true" />
<property name="cacheManagerName" value="myCacheManager" />
</bean>
WebShere 6.1, Spring 3.0.6.RELEASE, EHCache ???
public class NonDestroyEhCacheManagerFactoryBean extends org.springframework.cache.ehcache.EhCacheManagerFactoryBean
{
@Override
public void destroy() {
/**
* Don't
*/
}
}