Class JakartaFileCleaner
java.lang.Object
org.apache.commons.fileupload2.jakarta.servlet6.JakartaFileCleaner
- All Implemented Interfaces:
ServletContextListener,EventListener
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 StringAttribute name, which is used for storing an instance ofFileCleaningTrackerin the web application. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the web application is being destroyed.voidCalled when the web application is initialized.static org.apache.commons.io.FileCleaningTrackergetFileCleaningTracker(ServletContext servletContext) Gets the instance ofFileCleaningTracker, which is associated with the givenServletContext.static voidsetFileCleaningTracker(ServletContext servletContext, org.apache.commons.io.FileCleaningTracker tracker) 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 ofFileCleaningTrackerin the web application.
-
-
Constructor Details
-
JakartaFileCleaner
public JakartaFileCleaner()Constructs a new instance.
-
-
Method Details
-
getFileCleaningTracker
public static org.apache.commons.io.FileCleaningTracker getFileCleaningTracker(ServletContext servletContext) Gets the instance ofFileCleaningTracker, which is associated with the givenServletContext.- Parameters:
servletContext- The servlet context to query- Returns:
- The contexts tracker
-
setFileCleaningTracker
public static void setFileCleaningTracker(ServletContext servletContext, org.apache.commons.io.FileCleaningTracker tracker) Sets the instance ofFileCleaningTracker, which is associated with the givenServletContext.- Parameters:
servletContext- The servlet context to modifytracker- The tracker to set
-
contextDestroyed
Called when the web application is being destroyed. CallsFileCleaningTracker.exitWhenFinished().- Specified by:
contextDestroyedin interfaceServletContextListener- Parameters:
sce- The servlet context, used for callinggetFileCleaningTracker(ServletContext).
-
contextInitialized
Called when the web application is initialized. Does nothing.- Specified by:
contextInitializedin interfaceServletContextListener- Parameters:
sce- The servlet context, used for callingsetFileCleaningTracker(ServletContext, FileCleaningTracker).
-