public class ServletContextCleaner
extends java.lang.Object
implements javax.servlet.ServletContextListener
In general, the WeakHashtable support added in commons-logging release 1.1 ensures that logging classes do not hold references that prevent an undeployed webapp's memory from being garbage-collected even when multiple copies of commons-logging are deployed via multiple classloaders (a situation that earlier versions had problems with). However there are some rare cases where the WeakHashtable approach does not work; in these situations specifying this class as a listener for the web application will ensure that all references held by commons-logging are fully released.
To use this class, configure the webapp deployment descriptor to call this class on webapp undeploy; the contextDestroyed method will tell every accessable LogFactory class that the entry in its map for the current webapp's context classloader should be cleared.
| 构造器和说明 |
|---|
ServletContextCleaner() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
contextDestroyed(javax.servlet.ServletContextEvent sce)
Invoked when a webapp is undeployed, this tells the LogFactory
class to release any logging information related to the current
contextClassloader.
|
void |
contextInitialized(javax.servlet.ServletContextEvent sce)
Invoked when a webapp is deployed.
|
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
contextDestroyed 在接口中 javax.servlet.ServletContextListenerpublic void contextInitialized(javax.servlet.ServletContextEvent sce)
contextInitialized 在接口中 javax.servlet.ServletContextListenerCopyright © 2018. All Rights Reserved.