Class ServletContextCleaner
- All Implemented Interfaces:
EventListener
,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 class loaders (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 accessible LogFactory class that the entry in its map for the current webapp's context class loader should be cleared.
- Since:
- 1.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked when a webapp is undeployed, this tells the LogFactory class to release any logging information related to the current contextClassloader.void
Invoked when a webapp is deployed.
-
Constructor Details
-
ServletContextCleaner
public ServletContextCleaner()Constructs a new instance.
-
-
Method Details
-
contextDestroyed
Invoked when a webapp is undeployed, this tells the LogFactory class to release any logging information related to the current contextClassloader.- Specified by:
contextDestroyed
in interfaceServletContextListener
-
contextInitialized
Invoked when a webapp is deployed. Nothing needs to be done here.- Specified by:
contextInitialized
in interfaceServletContextListener
-