All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Abstract.ReceiverThread

Abstract.Connection
   |
   +----Abstract.ReceiverThread

public abstract class ReceiverThread
extends Connection
The receiver abstract class. Check socket input stream and if a message string is received, construct a message object and invoke Act(Object) method of AgentAction. From beta version, writeMsg(String) will throw Connection exception if IO error or some other error conditions.

See Also:
BRecvThread

Variable Index

 o _queue
Message Queue object.

Constructor Index

 o ReceiverThread()
Default constructor
 o ReceiverThread(String)
Set thread name
 o ReceiverThread(ThreadGroup, String)
Constructor with thread group, id

Method Index

 o cleanUp()
Clean up the data members initialized by this thread
 o closeSocket()
Close all the connections and stop thread
 o getMessageQueue()
Get message queue
 o getOneMessage()
Get one message from the receiver thread.
 o setMessageQueue(MessageBuffer)
Set message queue
 o writeMsg(String)
Send one message

Variables

 o _queue
 protected MessageBuffer _queue
Message Queue object. JATLite always assumes that the receiver thread has a message queue. Received messages will be saved to the queue. AgentAction will check the message queue and retrieve if it is not empty.

See Also:
MessageBuffer

Constructors

 o ReceiverThread
 public ReceiverThread()
Default constructor

 o ReceiverThread
 public ReceiverThread(String name)
Set thread name

Parameters:
name - ReceiverThread name
 o ReceiverThread
 public ReceiverThread(ThreadGroup tg,
                       String name)
Constructor with thread group, id

Parameters:
tg - Thread group
id - Thread(agent) name

Methods

 o setMessageQueue
 public void setMessageQueue(MessageBuffer queue)
Set message queue

Parameters:
queue - Message Buffer
 o getMessageQueue
 public MessageBuffer getMessageQueue()
Get message queue

Returns:
Message Buffer
 o getOneMessage
 public abstract String getOneMessage()
Get one message from the receiver thread. In general, this method is less efficient than to read several messages at once and menage them.

 o writeMsg
 public abstract void writeMsg(String msg) throws ConnectionException
Send one message

Parameters:
msg - String to be sent
Throws: ConnectionException
will be thrown if IO error occurs.
 o cleanUp
 protected abstract void cleanUp()
Clean up the data members initialized by this thread

 o closeSocket
 protected abstract void closeSocket()
Close all the connections and stop thread


All Packages  Class Hierarchy  This Package  Previous  Next  Index