|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CacheContextListener.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* Copyright (c) 2002-2003 by OpenSymphony
|
|
| 3 |
* All rights reserved.
|
|
| 4 |
*/
|
|
| 5 |
package com.opensymphony.oscache.web;
|
|
| 6 |
|
|
| 7 |
import javax.servlet.ServletContext;
|
|
| 8 |
import javax.servlet.ServletContextEvent;
|
|
| 9 |
import javax.servlet.ServletContextListener;
|
|
| 10 |
|
|
| 11 |
/**
|
|
| 12 |
*
|
|
| 13 |
* @author <a href="mailto:chris@swebtec.com">Chris Miller</a>
|
|
| 14 |
*/
|
|
| 15 |
public class CacheContextListener implements ServletContextListener { |
|
| 16 |
/**
|
|
| 17 |
* This notification occurs when the webapp is ready to process requests.<p>
|
|
| 18 |
* We use this hook to cleanly start up the {@link ServletCacheAdministrator}
|
|
| 19 |
* and create the application scope cache (which will consequentially
|
|
| 20 |
* initialize any listeners configured for it that implement <code>LifecycleAware</code>.)<p>
|
|
| 21 |
*
|
|
| 22 |
* As of Servlet 2.4, this is guaranteed to be called before any Servlet.init()
|
|
| 23 |
* methods.
|
|
| 24 |
*/
|
|
| 25 | 0 |
public void contextInitialized(ServletContextEvent servletContextEvent) { |
| 26 | 0 |
ServletContext context = servletContextEvent.getServletContext(); |
| 27 | 0 |
ServletCacheAdministrator.getInstance(context); |
| 28 |
} |
|
| 29 |
|
|
| 30 |
/**
|
|
| 31 |
* This notification occurs when the servlet context is about to be shut down.
|
|
| 32 |
* We use this hook to cleanly shut down the cache.
|
|
| 33 |
*/
|
|
| 34 | 0 |
public void contextDestroyed(ServletContextEvent servletContextEvent) { |
| 35 | 0 |
ServletContext context = servletContextEvent.getServletContext(); |
| 36 | 0 |
ServletCacheAdministrator.destroyInstance(context); |
| 37 |
} |
|
| 38 |
} |
|
| 39 |
|
|
||||||||||