Ver. 20060815

Server
Class WatchDog

java.lang.Object
  extended by java.lang.Thread
      extended by Server.WatchDog
All Implemented Interfaces:
java.lang.Runnable

public class WatchDog
extends java.lang.Thread

The startup class that watches the server threads and kills them when the server is exiting. It also launches the server and maintains the daemon thread. 2006/08/10 Kyle Reed


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  AdminConsole watch
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WatchDog(AdminConsole s)
          Constructor for the watch dog.
 
Method Summary
private  void closeModules()
          Tells the server to send close messages to the modules so they should exit nicely, allowing a restart of the server.
private  boolean closeRemoteAdmin()
          Attempts to nicely close the AdminConsole.
private  boolean closeSocketListener()
          Attempts to nicely close the main server listener in order to close all of the persistant connections.
static void main(java.lang.String[] args)
          Startup point for the server that starts the server and admin parachute threads.
 void run()
          Daemon thread of the WatchDog.
 
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
 

Field Detail

watch

AdminConsole watch
Constructor Detail

WatchDog

public WatchDog(AdminConsole s)
Constructor for the watch dog. It takes a reference to the AdminConsole object that contains the actual server to be watched. 2006/08/10 Kyle Reed

Method Detail

main

public static void main(java.lang.String[] args)
Startup point for the server that starts the server and admin parachute threads. 2006/08/10 Kyle Reed


run

public void run()
Daemon thread of the WatchDog. Checks every 2 seconds to see if a part has set the Server.alive flag to false. If it's false then it runs the shutdown routine that cleans up the connections threads. 2006/08/10 Kyle Reed

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

closeModules

private void closeModules()
Tells the server to send close messages to the modules so they should exit nicely, allowing a restart of the server. 2006/08/10 Kyle Reed


closeSocketListener

private boolean closeSocketListener()
Attempts to nicely close the main server listener in order to close all of the persistant connections. Returns true if the listener closes nicely. 2006/08/10 Kyle Reed


closeRemoteAdmin

private boolean closeRemoteAdmin()
Attempts to nicely close the AdminConsole. Returns true if the AdminConsole closes nicely. 2006/08/10 Kyle Reed


Ver. 20060815