com.opensymphony.oscache.web
Class CacheContextListener

java.lang.Object
  extended by com.opensymphony.oscache.web.CacheContextListener
All Implemented Interfaces:
EventListener, ServletContextListener

public class CacheContextListener
extends Object
implements ServletContextListener

Class for a clean startup and shutdown of the ServletCacheAdministrator and its application scoped cache.

Author:
Chris Miller

Constructor Summary
CacheContextListener()
           
 
Method Summary
 void contextDestroyed(ServletContextEvent servletContextEvent)
          This notification occurs when the servlet context is about to be shut down.
 void contextInitialized(ServletContextEvent servletContextEvent)
          This notification occurs when the webapp is ready to process requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheContextListener

public CacheContextListener()
Method Detail

contextInitialized

public void contextInitialized(ServletContextEvent servletContextEvent)
This notification occurs when the webapp is ready to process requests.

We use this hook to cleanly start up the ServletCacheAdministrator and create the application scope cache (which will consequentially initialize any listeners configured for it that implement LifecycleAware.)

As of Servlet 2.4, this is guaranteed to be called before any Servlet.init() methods.

Specified by:
contextInitialized in interface ServletContextListener

contextDestroyed

public void contextDestroyed(ServletContextEvent servletContextEvent)
This notification occurs when the servlet context is about to be shut down. We use this hook to cleanly shut down the cache.

Specified by:
contextDestroyed in interface ServletContextListener

OSCache Project Page