|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.dyade.aaa.agent.MessageSoftList
public class MessageSoftList
This class holds a list of Message
, waiting to be sent. After sending
one message it is marked as sent, which means it is kept until its
acknowledgment. Once acknowledged, the message is deleted.
This list can hold an acknowledgment message, which is always the first one
to be sent if present.
If the list is marked as persistent, messages are encapsulated by
MessageSoftRef
in order to be garbaged from memory if necessary.
Constructor Summary | |
---|---|
MessageSoftList(java.lang.String name,
boolean persistent)
|
Method Summary | |
---|---|
void |
addMessage(fr.dyade.aaa.agent.Message msg)
Adds a message at the end of the list. |
void |
deleteMessagesUpTo(int stamp)
Iterates over messages waiting for an acknowledge to delete the ones which have a stamp inferior or equal to the given one. |
fr.dyade.aaa.agent.Message |
getAck()
Returns the acknowledge waiting to be sent if present. |
fr.dyade.aaa.agent.Message |
getFirst()
Returns the first non expired message waiting to be sent. |
void |
reset()
Resets all messages waiting for an acknowledge: they are placed back at the beginning of the list respecting their stamp order. |
int |
sentSize()
Returns the number of messages waiting for an ack. |
void |
setAck(fr.dyade.aaa.agent.Message ack)
Sets the next ack to send. |
void |
setSent(fr.dyade.aaa.agent.Message msg)
Mark specified message as sent (ie waiting for an ack). |
java.util.Iterator |
toSendIterator()
Returns an iterator over the messages waiting to be sent. |
int |
toSendSize()
Returns the number of messages waiting to be sent. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MessageSoftList(java.lang.String name, boolean persistent)
Method Detail |
---|
public void addMessage(fr.dyade.aaa.agent.Message msg)
setAck(Message)
if you
want to add an ack to the list.
public fr.dyade.aaa.agent.Message getAck()
public fr.dyade.aaa.agent.Message getFirst()
public void deleteMessagesUpTo(int stamp) throws java.io.IOException
stamp
- the stamp of the last message acked.
java.io.IOException
public void setAck(fr.dyade.aaa.agent.Message ack)
public java.util.Iterator toSendIterator()
public java.lang.String toString()
toString
in class java.lang.Object
public void reset()
public int toSendSize()
public void setSent(fr.dyade.aaa.agent.Message msg)
getFirst()
.
msg
- the message which have been sent.public int sentSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |