Hi Les,

I am running into the same issue when configuring Shiro programatically with
Guice (I do not use a shiro.ini file).  When I shutdown Tomcat, there are
several ehcache threads that are not getting destroyed.  I tried setting the
system property CacheManager.ENABLE_SHUTDOWN_HOOK_PROPERTY=TRUE and it did
not solve the problem.  

I have also been attempting to force cleanup in my
GuiceServletContextListener by overriding contextDestroyed. My thought was
to get a handle to my realm and force shutdown through the CacheManager. 
This approach is not working for me.  I see that my contextDestroyed gets
hit, but calling shutdown() on my CacheManager, is not destroying the
threads.

Here is what my contextDestroyed looks like:

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
          
        CustomRealm realm = injector.getInstance(CustomRealm.class);
      
        if(realm instanceof AuthorizingRealm) {
            CacheManager manager = realm.getCacheManager();
            if(manager instanceof EhCacheManager) {
                EhCacheManager ehManager = (EhCacheManager)manager;
                ehManager.getCacheManager().shutdown();

            }
        }
    }


Any thoughts would be greatly appreciated.

Thanks,
-Shane


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

Reply via email to