org.activemath.util.checks
Class MailingChecker

java.lang.Object
  extended by java.lang.Thread
      extended by org.activemath.util.checks.MailingChecker
All Implemented Interfaces:
Runnable

public class MailingChecker
extends Thread

Checker watchdog. Calls specified checks and sends mail(s) if they are failing. Main tasks:

Preconditions:

this class expects a configuration variable MailingChecker.updateInterval set to retrieve from the configuration Manager, which indicates how much time should go by between tests in seconds. If it is missing or zero, a standard value of 600 is assumed. starting up is done via the script "activemath/bin/amMailingChecker start" shutdown is done via "activeMath/bin/amMailingChecker stop". You can also check the Checker's conditions via "activeMath/bin/amMailingChecker status". Note that on any operation, the Checker's main method first checks whether the calling user has read access to the checker's session ID file, before it allows status/stop operations.

XMLRPC-invoked calls don't, but they are restricted to the machine the checker is running on, criticl methods, such as "stop" require the session key to be presented.

The session key is (for future ;-) made of 4 32-bit randomly selected integers, but it is not really secure:

This class is not prepared yet for internationalization; code needing adaption is marked ///i

Version:
0.1

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
MailingChecker(Subconfiguration config)
          Constructor starting the thread
 
Method Summary
protected  void finalize()
           
 String getStateUpdate()
          get status as a string
static void main(String[] args)
          handlest startup and shutdown of the MailingChecker using XMLRPC.
 void run()
          runs the tests.
 String shutDown(String sessionKey)
          initiates a friendly shutdown, i.E. sets the aborted variable to false and causes an interrupt.
protected  void writeStateUpdate(PrintWriter writer)
          writes a status update to a Writer
 
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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MailingChecker

public MailingChecker(Subconfiguration config)
Constructor starting the thread

Method Detail

finalize

protected void finalize()
Overrides:
finalize in class Object

shutDown

public String shutDown(String sessionKey)
initiates a friendly shutdown, i.E. sets the aborted variable to false and causes an interrupt. This method is intended to be called via XMLRPC.

Parameters:
sessionKey - String which is compared to this.sessionKey. Only if they are equal, a shutdown is really accomplished
Returns:
void

run

public void run()
runs the tests. After the aborted is pulled down, shut all checks down.

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

writeStateUpdate

protected void writeStateUpdate(PrintWriter writer)
writes a status update to a Writer

Parameters:
writer - PrintWriter to which the status is to be written

getStateUpdate

public String getStateUpdate()
get status as a string

Returns:
void

main

public static void main(String[] args)
handlest startup and shutdown of the MailingChecker using XMLRPC.

Parameters:
args - command-line arguments