java.io
Class DeleteOnExit
java.lang.Object
java.lang.Thread
java.io.DeleteOnExit
- All Implemented Interfaces:
- Runnable
class DeleteOnExit
- extends Thread
Implements the actual DeleteOnExit mechanism. Is registered as a shutdown
hook in the Runtime, once it is actually being used.
|
Method Summary |
void |
addFile(String filename)
Schedules a file for deletion. |
static DeleteOnExit |
getInstance()
Returns our singleton instance, creating it if necessary. |
void |
run()
Does the actual work. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
DeleteOnExit
DeleteOnExit()
getInstance
public static DeleteOnExit getInstance()
- Returns our singleton instance, creating it if necessary.
addFile
public void addFile(String filename)
- Schedules a file for deletion.
- Parameters:
filename - The file to delete.
run
public void run()
- Does the actual work. Note we (a) first sort the files lexicographically
and then (b) delete them in reverse order. This is to make sure files
get deleted before their parent directories.
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
- See Also:
Thread.start()
Please submit a feedback, bug or feature