Class FileCleanerCleanup
java.lang.Object
org.apache.commons.fileupload.servlet.FileCleanerCleanup
- All Implemented Interfaces:
EventListener
,ServletContextListener
A servlet context listener, which ensures that the
FileCleaningTracker
's reaper thread is terminated,
when the web application is destroyed.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Attribute name, which is used for storing an instance ofFileCleaningTracker
in the web application. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the web application is being destroyed.void
Called when the web application is initialized.static FileCleaningTracker
getFileCleaningTracker
(ServletContext pServletContext) Returns the instance ofFileCleaningTracker
, which is associated with the givenServletContext
.static void
setFileCleaningTracker
(ServletContext pServletContext, FileCleaningTracker pTracker) Sets the instance ofFileCleaningTracker
, which is associated with the givenServletContext
.
-
Field Details
-
FILE_CLEANING_TRACKER_ATTRIBUTE
Attribute name, which is used for storing an instance ofFileCleaningTracker
in the web application.
-
-
Constructor Details
-
FileCleanerCleanup
public FileCleanerCleanup()
-
-
Method Details
-
getFileCleaningTracker
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
Called when the web application is initialized. Does nothing.- Specified by:
contextInitialized
in interfaceServletContextListener
- Parameters:
sce
- The servlet context, used for callingsetFileCleaningTracker(ServletContext, FileCleaningTracker)
.
-
contextDestroyed
Called when the web application is being destroyed. CallsFileCleaningTracker.exitWhenFinished()
.- Specified by:
contextDestroyed
in interfaceServletContextListener
- Parameters:
sce
- The servlet context, used for callinggetFileCleaningTracker(ServletContext)
.
-