1 17 18 package com.whirlycott.cache.servlet; 19 20 import javax.servlet.ServletContextEvent ; 21 import javax.servlet.ServletContextListener ; 22 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 26 import com.whirlycott.cache.CacheException; 27 import com.whirlycott.cache.CacheManager; 28 import com.whirlycott.cache.Messages; 29 30 31 32 36 public class CacheManagerListener implements ServletContextListener { 37 38 41 private static final Log log = LogFactory.getLog(CacheManagerListener.class); 42 43 46 public void contextInitialized(final ServletContextEvent servletContextEvent) { 47 } 48 49 52 public void contextDestroyed(final ServletContextEvent servletContextEvent) { 53 try { 54 log.debug(Messages.getString("CacheManagerListener.shutting_down_whirlycache_due_to_servlet_destruction")); CacheManager.getInstance().shutdown(); 56 } catch (final CacheException e) { 57 log.error(e.getMessage(), e); 58 } 59 } 60 } 61 | Popular Tags |