utilities.controlmessage
Class ControlMessageListener

java.lang.Object
  extended by java.lang.Thread
      extended by utilities.controlmessage.ControlMessageListener
All Implemented Interfaces:
java.lang.Runnable

public class ControlMessageListener
extends java.lang.Thread

A thread that runs and listens for ControlMessages on a given port. When a message is received it is sent to a ControlMessageReceiver that is specified in the constructor.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.net.Socket clientSocket
           
protected  java.io.DataInputStream in
           
protected  int listenPort
           
protected  java.net.ServerSocket listenSocket
           
protected  Logger logger
           
protected  ControlMessageReceiver parent
           
protected  boolean running
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ControlMessageListener(int listenPort, ControlMessageReceiver parent)
           
ControlMessageListener(int listenPort, ControlMessageReceiver parent, Logger logger)
           
 
Method Summary
 void halt()
          Stops this object from running and closes it down cleanly
 void run()
          Provides the main thread operation.
 
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

listenSocket

protected java.net.ServerSocket listenSocket

clientSocket

protected java.net.Socket clientSocket

in

protected java.io.DataInputStream in

listenPort

protected int listenPort

parent

protected ControlMessageReceiver parent

logger

protected Logger logger

running

protected boolean running
Constructor Detail

ControlMessageListener

public ControlMessageListener(int listenPort,
                              ControlMessageReceiver parent,
                              Logger logger)
Parameters:
listenPort - The port number to listen on.
parent - The object that created this Listener.

ControlMessageListener

public ControlMessageListener(int listenPort,
                              ControlMessageReceiver parent)
Parameters:
listenPort - The port number to listen on.
parent - The object that created this Listener.
Method Detail

run

public void run()
Provides the main thread operation.

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

halt

public void halt()
Stops this object from running and closes it down cleanly