public class MessageQueue
extends java.lang.Object
AutonomicManager
. The Auto.messageReply(...)
method will do this automatically. The manager then has full access to all
messages and can use its control loop to process them and try to detect
errors or faults.Constructor and Description |
---|
MessageQueue()
Create a new instance of MessageQueue
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(MessageInfo messageInfo)
Add a new message to the list.
|
protected MessageInfo |
copyConversationMessage(java.lang.String commID,
int position)
Get a copy of the specified message in the specified conversation.
|
protected java.util.ArrayList<MessageInfo> |
copyMessageInterval(long startTime,
long endTime)
Get a copy of all messages time stamped between the two time intervals.
|
MessageInfo |
getAndRemoveMessageAt(int index)
Get the message at position
index in the queue and remove the message from all queues. |
MessageInfo |
getAndRemoveNextMessage()
Get the next message in the queue and remove the message from all queues.
|
MessageInfo |
getAndRemoveNextMessageName(java.lang.String methodName)
Get the next message in the queue relating to a particular method name.
|
MessageInfo |
getAndRemoveNextMessageTime(long timeStamp)
Get the next message in the queue relating to a particular time interval.
|
MessageInfo |
getAndRemoveNextMessageTime(long startTimeStamp,
long endTimeStamp)
Get the next message in the queue relating to a particular time interval.
|
protected java.util.ArrayList<java.lang.String> |
getCommIDs()
Get the lit of current communication IDs.
|
protected int |
getConversationLength(java.lang.String commID)
Get the number of messages related to a particular communication ID.
|
MessageInfo |
getMessageAt(int index)
Get the message at position
index in the queue, but keep the message in all queues. |
MessageInfo |
getNextMessage()
Get the next message in the queue, but keep the message in all queues.
|
boolean |
isEMpty()
Return true if the message queue is empty, meaning no message in the queue.
|
int |
queueSize()
Get the size of the message queue.
|
void |
removeAllMessages(java.lang.String commID)
Remove all messages, from both lists, with the specified communication ID.
|
protected void |
returnLastMessage(MessageInfo nextMessage)
Return the message to the start of the message queue
and update all other message lists.
|
protected java.util.ArrayList<java.lang.String> getCommIDs()
public void addMessage(MessageInfo messageInfo)
messageInfo
- a full MessageInfo
description. The unique communication
ID is required.public boolean isEMpty()
public int queueSize()
public MessageInfo getMessageAt(int index)
index
in the queue, but keep the message in all queues.index
- index of the message to retrieve.index
in the queue, or null if out of range.public MessageInfo getNextMessage()
public MessageInfo getAndRemoveMessageAt(int index)
index
in the queue and remove the message from all queues.index
- index of the message to retrieve.index
in the queue, or null if out of range.public MessageInfo getAndRemoveNextMessage()
public MessageInfo getAndRemoveNextMessageTime(long startTimeStamp, long endTimeStamp)
startTimeStamp
- the start time interval for the message.endTimeStamp
- the end time interval for the message.public MessageInfo getAndRemoveNextMessageTime(long timeStamp)
timeStamp
- the exact timestamp for the message.public MessageInfo getAndRemoveNextMessageName(java.lang.String methodName)
MethodInfo
object and it also automatically removes the
message from all queues.methodName
- the name of the method to retrieve.public void removeAllMessages(java.lang.String commID)
commID
- the message communication ID.protected void returnLastMessage(MessageInfo nextMessage)
nextMessage
- the message to add again.protected int getConversationLength(java.lang.String commID)
commID
- the communication ID.protected MessageInfo copyConversationMessage(java.lang.String commID, int position)
getAndRemoveMessage
to retrieve the message and also remove it from the queue.commID
- the communication ID.position
- the position of the message in the communication queue.protected java.util.ArrayList<MessageInfo> copyMessageInterval(long startTime, long endTime)
getAndRemoveMessage
to retrieve the message and also remove it from the queue.startTime
- the start of the time interval.endTime
- the end of the time interval.