TrueZIP 6.8.2

de.schlichtherle.io
Class ArchiveControllers.ShutdownHook

java.lang.Object
  extended by java.lang.Thread
      extended by de.schlichtherle.io.ArchiveControllers.ShutdownHook
All Implemented Interfaces:
Runnable
Enclosing class:
ArchiveControllers

static final class ArchiveControllers.ShutdownHook
extends Thread

TrueZIP's singleton shutdown hook for the JVM. This shutdown hook is always run, even if the JVM terminates due to an uncatched Throwable. Only a JVM crash could prevent this, but this is an extremely rare situation.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
(package private) static Set deleteOnExit
          The set of files to delete when the shutdown hook is run.
private static ArchiveControllers.ShutdownHook SINGLETON
          The singleton instance.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
private ArchiveControllers.ShutdownHook()
          You cannot instantiate this singleton class.
 
Method Summary
 void run()
          Deletes all files that have been marked by File.deleteOnExit() and finally unmounts all controllers.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SINGLETON

private static final ArchiveControllers.ShutdownHook SINGLETON
The singleton instance.


deleteOnExit

static final Set deleteOnExit
The set of files to delete when the shutdown hook is run. When iterating over it, its elements are returned in insertion order.

Constructor Detail

ArchiveControllers.ShutdownHook

private ArchiveControllers.ShutdownHook()
You cannot instantiate this singleton class.

Method Detail

run

public void run()
Deletes all files that have been marked by File.deleteOnExit() and finally unmounts all controllers.

Logging and password prompting will be disabled (they wouldn't work in a JVM shutdown hook anyway) in order to provide a deterministic behaviour and in order to avoid RuntimeExceptions or even Errors in the API.

Any exceptions thrown throughout the umount will be printed on standard error output.

Note that this method is not re-entrant and should not be directly called except for unit testing (you couldn't do a unit test on a shutdown hook otherwise, could you?).

Specified by:
run in interface Runnable
Overrides:
run in class Thread

TrueZIP 6.8.2

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.