net.sf.ehcache.constructs.web

Class ShutdownListener

public class ShutdownListener extends Object implements ServletContextListener

A ServletContextListener that shutsdown CacheManager. Use this when you want to shutdown ehcache automatically when the web application is shutdown. If the web application is in a VM which is being shutdown, the ehcache shutdown hooks will do the work and this class is not required.

To receive notification events, this class must be configured in the deployment descriptor for the web application. To do so, add the following to web.xml in your web application:

 <listener>
      net.sf.ehcache.constructs.web.ShutdownListener
 </listener>
 

Version: $Id: ShutdownListener.java 158 2006-07-16 04:50:22Z gregluck $

Author: Daniel Wiell Greg Luck

Method Summary
voidcontextDestroyed(ServletContextEvent servletContextEvent)
Notification that the servlet context is about to be shut down.
voidcontextInitialized(ServletContextEvent servletContextEvent)
Notification that the web application is ready to process requests.

Method Detail

contextDestroyed

public void contextDestroyed(ServletContextEvent servletContextEvent)
Notification that the servlet context is about to be shut down.

Shuts down all cache managers known to ALL_CACHE_MANAGERS

Parameters: servletContextEvent

contextInitialized

public void contextInitialized(ServletContextEvent servletContextEvent)
Notification that the web application is ready to process requests.

Parameters: servletContextEvent