org.aitools.programd
Class CoreShutdownHook

java.lang.Object
  extended by java.lang.Thread
      extended by org.aitools.programd.CoreShutdownHook
All Implemented Interfaces:
java.lang.Runnable

public class CoreShutdownHook
extends java.lang.Thread

Runs the shutdown method of a Core when it is started. This is intended to be attached via Runtime.addShutdownHook() for any configuration where it is possible that the entire system may exit. Of course this doesn't apply to many cases (such as if the Core is a component in an application server), so this may not always be used. When this class's run() method is called, it first checks that the Core has not been shut down already.

Author:
Noel Bush

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  Core core
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CoreShutdownHook(Core aCore)
          Creates a new CoreShutdownHook to manage the shutdown of the given Core
 
Method Summary
 void run()
          Shuts down the Core assigned to this thread.
 
Methods inherited from class java.lang.Thread
activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, checkAccess, 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
 

Field Detail

core

private Core core
Constructor Detail

CoreShutdownHook

public CoreShutdownHook(Core aCore)
Creates a new CoreShutdownHook to manage the shutdown of the given Core

Parameters:
aCore - the Core whose shutdown method should be run when this thread is run
Method Detail

run

public void run()
Shuts down the Core assigned to this thread.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()