Hi All,

I have an update on this issue.  I am not sure that this is the most elegant
approach, but here is what I did to clean up my dangling ehcache threads and
get a clean Tomcat shutdown...

I shutdown the CacheManager and destroyed the ehcache threads, by overriding
GuiceServletContextListener contextDestroyed.  Initially, I was attempting
to get a handle to my realm by injecting it. This was erroring out because
my realm singleton was being terminated prior to reaching the
GuiceServletContextListener. When attempting to inject the realm, a new
instance was being instantiated and causing a naming conflict with the
active ehcache threads.

I used a static method in net.sf.ehcache.CacheManager to get a handle to the
active CacheManager instance.  Once I had the handle, I was able to call
shutdown on it.

@Override
public void contextDestroyed(servletContextEvent servletContextEvent) {
    net.sf.ehcache.cacheManager manager =
net.sf.ehcache.CacheManager.getInstance();
    if(manager!= null) {
        manager.shutdown();
    }
}

Cheers,
:Shane

--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Unclean-shutdown-of-Tomcat-related-to-EhCacheManager-tp6267587p7407169.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to