util
Class RegistryCleaner

java.lang.Object
  extended by java.lang.Thread
      extended by util.RegistryCleaner
All Implemented Interfaces:
Runnable, ExitCleaning

public class RegistryCleaner
extends Thread
implements ExitCleaning

A thread that clears bindings found in the local registry. It can be used as a shutdown-hook to allow crashing applications to leave the registry in a coherent state.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  List clear
          Only bindings found in the list are cleared.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RegistryCleaner()
          Constructs a new registry cleaner that ereases all bindings found in the local registry.
RegistryCleaner(List bindings)
          Constructs a registry cleaner that ereases all bindings found in the argument list on running.
 
Method Summary
private  void clearRegistry()
          Clears all binding found in the local registry.
 void exit()
          Clears all binding found in the local registry.
 void run()
          Clears the bindings found in the local registry.
 
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

clear

private List clear
Only bindings found in the list are cleared. If null, all bindings are released.

Constructor Detail

RegistryCleaner

public RegistryCleaner()
Constructs a new registry cleaner that ereases all bindings found in the local registry.


RegistryCleaner

public RegistryCleaner(List bindings)
Constructs a registry cleaner that ereases all bindings found in the argument list on running.

Method Detail

run

public void run()
Clears the bindings found in the local registry. A list of all bindings available at the local registry is retrieved. If the look-up list of to-release bindings, clear is not null, the bindings found are matched to entries in this list and, if present, are unbound. If the release-binding list is null, all bindings found are unbound.

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

exit

public void exit()
Clears all binding found in the local registry. Equal to run() except that this is the thread-less version.

Specified by:
exit in interface ExitCleaning

clearRegistry

private void clearRegistry()
Clears all binding found in the local registry.