|
Apache Tomcat 7.0.42 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tomcat.util.http.fileupload.FileCleaningTracker
public class FileCleaningTracker
Keeps track of files awaiting deletion, and deletes them when an associated marker object is reclaimed by the garbage collector.
This utility creates a background thread to handle file deletion. Each file to be deleted is registered with a handler object. When the handler object is garbage collected, the file is deleted.
In an environment with multiple class loaders (a servlet container, for
example), you should consider stopping the background thread if it is no
longer needed. This is done by invoking the method
exitWhenFinished
, typically in
ServletContextListener.contextDestroyed(javax.servlet.ServletContextEvent)
or similar.
Constructor Summary | |
---|---|
FileCleaningTracker()
|
Method Summary | |
---|---|
void |
track(File file,
Object marker)
Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected. |
void |
track(File file,
Object marker,
FileDeleteStrategy deleteStrategy)
Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileCleaningTracker()
Method Detail |
---|
public void track(File file, Object marker)
normal
deletion strategy will be used.
file
- the file to be tracked, not nullmarker
- the marker object used to track the file, not null
NullPointerException
- if the file is nullpublic void track(File file, Object marker, FileDeleteStrategy deleteStrategy)
file
- the file to be tracked, not nullmarker
- the marker object used to track the file, not nulldeleteStrategy
- the strategy to delete the file, null means normal
NullPointerException
- if the file is null
|
Apache Tomcat 7.0.42 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |