Package org.apache.harmony.luni.util
Class DeleteOnExit
java.lang.Object
java.lang.Thread
org.apache.harmony.luni.util.DeleteOnExit
- All Implemented Interfaces:
Runnable
public class DeleteOnExit extends Thread
Implements the actual DeleteOnExit mechanism. Is registered as a shutdown
hook in the Runtime, once it is actually being used.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors Constructor Description DeleteOnExit() -
Method Summary
Modifier and Type Method Description voidaddFile(String filename)Schedules a file for deletion.static DeleteOnExitgetInstance()Returns our singleton instance, creating it if necessary.voidrun()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, parkFor, parkUntil, popInterruptAction$, pushInterruptAction$, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, unpark, yield
-
Constructor Details
-
DeleteOnExit
public DeleteOnExit()
-
-
Method Details
-
getInstance
Returns our singleton instance, creating it if necessary. -
addFile
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:
runin interfaceRunnable- Overrides:
runin classThread- See Also:
Thread.start()
-