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
-
_queue
- Message Queue object.
-
ReceiverThread()
- Default constructor
-
ReceiverThread(String)
- Set thread name
-
ReceiverThread(ThreadGroup, String)
- Constructor with thread group, id
-
cleanUp()
- Clean up the data members initialized by this thread
-
closeSocket()
- Close all the connections and stop thread
-
getMessageQueue()
- Get message queue
-
getOneMessage()
- Get one message from the receiver thread.
-
setMessageQueue(MessageBuffer)
- Set message queue
-
writeMsg(String)
- Send one message
_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
ReceiverThread
public ReceiverThread()
- Default constructor
ReceiverThread
public ReceiverThread(String name)
- Set thread name
- Parameters:
- name - ReceiverThread name
ReceiverThread
public ReceiverThread(ThreadGroup tg,
String name)
- Constructor with thread group, id
- Parameters:
- tg - Thread group
- id - Thread(agent) name
setMessageQueue
public void setMessageQueue(MessageBuffer queue)
- Set message queue
- Parameters:
- queue - Message Buffer
getMessageQueue
public MessageBuffer getMessageQueue()
- Get message queue
- Returns:
- Message Buffer
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.
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.
cleanUp
protected abstract void cleanUp()
- Clean up the data members initialized by this thread
closeSocket
protected abstract void closeSocket()
- Close all the connections and stop thread
All Packages Class Hierarchy This Package Previous Next Index