Build 1.0_r1(from source)

java.io
Class DeleteOnExit

java.lang.Object
  extended by java.lang.Thread
      extended by 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.


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
DeleteOnExit()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeleteOnExit

DeleteOnExit()
Method Detail

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()

Build 1.0_r1(from source)

Please submit a feedback, bug or feature