com.isti.quakewatch.util
Class ServerTrackingThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.isti.quakewatch.util.ServerTrackingThread
All Implemented Interfaces:
QWAliveMsgListener, java.lang.Runnable

public class ServerTrackingThread
extends java.lang.Thread
implements QWAliveMsgListener

Class ServerTrackingThread defines a thread that tracks the status of the QuakeWatch server.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerTrackingThread(QWConnectionMgr connMgrObj)
          Creates the thread that tracks the status of the QuakeWatch server.
 
Method Summary
 void aliveMsgReceived(QWStatusMsgRecord recObj)
          Called each time an "Alive" message is received from the QWServer.
 void connReinitialized(boolean userInitFlag)
          Called when the connection is about to be reinitialized.
 boolean isConnectionValidated()
          Returns the status of whether or not the connection has been "validated" via the receipt of any server-alive messages.
 void maxServerAliveSecChanged()
          Called when the 'maxServerAliveSec' property has changed.
 void run()
          Runs this thread.
 void terminate()
          Terminates this thread.
 
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
 

Constructor Detail

ServerTrackingThread

public ServerTrackingThread(QWConnectionMgr connMgrObj)
Creates the thread that tracks the status of the QuakeWatch server.

Parameters:
connMgrObj - the connection-manager object to use.
Method Detail

run

public void run()
Runs this thread.

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

aliveMsgReceived

public void aliveMsgReceived(QWStatusMsgRecord recObj)
Called each time an "Alive" message is received from the QWServer. This method implements the 'QWAliveMsgListener' interface.

Specified by:
aliveMsgReceived in interface QWAliveMsgListener
Parameters:
recObj - the 'QWStatusMsgRecord' object for the received message.

connReinitialized

public void connReinitialized(boolean userInitFlag)
Called when the connection is about to be reinitialized.

Parameters:
userInitFlag - true to indicate that the connnection-reinit was signaled via user input.

maxServerAliveSecChanged

public void maxServerAliveSecChanged()
Called when the 'maxServerAliveSec' property has changed. This interrupts the 'sleep()' that may be in progress with an old (possibly large) value.


isConnectionValidated

public boolean isConnectionValidated()
Returns the status of whether or not the connection has been "validated" via the receipt of any server-alive messages.

Returns:
true if any server-alive messages have been received since the last connect-to-server attempt, false if not.

terminate

public void terminate()
Terminates this thread.