Class FileCleanerCleanup
- java.lang.Object
-
- org.apache.commons.fileupload.servlet.FileCleanerCleanup
-
- All Implemented Interfaces:
java.util.EventListener,ServletContextListener
public class FileCleanerCleanup extends java.lang.Object implements ServletContextListener
A servlet context listener, which ensures that theFileCleaningTracker's reaper thread is terminated, when the web application is destroyed.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFILE_CLEANING_TRACKER_ATTRIBUTEAttribute name, which is used for storing an instance ofFileCleaningTrackerin the web application.
-
Constructor Summary
Constructors Constructor Description FileCleanerCleanup()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(ServletContextEvent sce)Called when the web application is being destroyed.voidcontextInitialized(ServletContextEvent sce)Called when the web application is initialized.static FileCleaningTrackergetFileCleaningTracker(ServletContext pServletContext)Returns the instance ofFileCleaningTracker, which is associated with the givenServletContext.static voidsetFileCleaningTracker(ServletContext pServletContext, FileCleaningTracker pTracker)Sets the instance ofFileCleaningTracker, which is associated with the givenServletContext.
-
-
-
Field Detail
-
FILE_CLEANING_TRACKER_ATTRIBUTE
public static final java.lang.String FILE_CLEANING_TRACKER_ATTRIBUTE
Attribute name, which is used for storing an instance ofFileCleaningTrackerin the web application.
-
-
Method Detail
-
getFileCleaningTracker
public static FileCleaningTracker getFileCleaningTracker(ServletContext pServletContext)
Returns the instance ofFileCleaningTracker, which is associated with the givenServletContext.- Parameters:
pServletContext- The servlet context to query- Returns:
- The contexts tracker
-
setFileCleaningTracker
public static void setFileCleaningTracker(ServletContext pServletContext, FileCleaningTracker pTracker)
Sets the instance ofFileCleaningTracker, which is associated with the givenServletContext.- Parameters:
pServletContext- The servlet context to modifypTracker- The tracker to set
-
contextInitialized
public void contextInitialized(ServletContextEvent sce)
Called when the web application is initialized. Does nothing.- Specified by:
contextInitializedin interfaceServletContextListener- Parameters:
sce- The servlet context, used for callingsetFileCleaningTracker(ServletContext, FileCleaningTracker).
-
contextDestroyed
public void contextDestroyed(ServletContextEvent sce)
Called when the web application is being destroyed. CallsFileCleaningTracker.exitWhenFinished().- Specified by:
contextDestroyedin interfaceServletContextListener- Parameters:
sce- The servlet context, used for callinggetFileCleaningTracker(ServletContext).
-
-