amber.server.application
Class EventThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--amber.server.application.EventThread
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class EventThread
extends java.lang.Thread
implements java.io.Serializable

Thread to deal with the reception of messages destined for one of the ComponentHandlers. Sits on a socket, blocking until bytes are received. Transmission is handled by the ApplicationHandler itself.

Version:
1.0.0
Author:
Mark Howard, Dr. David J. Knowles
See Also:
ApplicationHandler, Serialized Form

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
EventThread(java.lang.ThreadGroup group, ApplicationInterface parent)
          Construct the thread, with it's parent class so it may pass back messages.
 
Method Summary
 void addEventPacket(Packet packet)
          Adds an event packet for processing.
 void deactivate()
          This function causes the flag to be set disabling this thread.
 ApplicationInterface getParent()
          This function returns the parent application to which messages will be sent.
 boolean isActive()
          Returns whether the thread is active.
 boolean isOperating()
          Returns the state of the thread.
 void restart()
          Forces the thread to restart.
 void run()
          Main operating function.
 void setParent(ApplicationInterface parent)
          This function sets the parent application to which messages will be sent.
 void terminate()
          This function causes the flag to be set terminating this thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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
 

Constructor Detail

EventThread

public EventThread(java.lang.ThreadGroup group,
                   ApplicationInterface parent)
Construct the thread, with it's parent class so it may pass back messages.
Parameters:
group - ThreadGroup this thread belongs to.
parent - ApplicationInterface which is the parent of this thread.
Method Detail

addEventPacket

public void addEventPacket(Packet packet)
Adds an event packet for processing.
Parameters:
packet - Event Packet to process.

restart

public void restart()
Forces the thread to restart.

run

public void run()
Main operating function.
Overrides:
run in class java.lang.Thread

terminate

public void terminate()
This function causes the flag to be set terminating this thread.

deactivate

public void deactivate()
This function causes the flag to be set disabling this thread. The thread is still alive however it will perform no more operations.

isOperating

public boolean isOperating()
Returns the state of the thread.
Returns:
boolean true if operating normally.

isActive

public boolean isActive()
Returns whether the thread is active. This thread will be active if operating normally and inactive if suspended waiting for a connection to reestablish itself if lost.
Returns:
boolean true if active.

setParent

public void setParent(ApplicationInterface parent)
This function sets the parent application to which messages will be sent.
Parameters:
parent - ApplicationInterface which is to be the new parent.

getParent

public ApplicationInterface getParent()
This function returns the parent application to which messages will be sent.
Returns:
ApplicationInterface which is the parent.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.