Thanks Todd,<br><br>I opened the PingSender and PingReceiver files again and noticed the line that removes the relay. I must say the information I needed was there but didn't see it in the first place. Good thing you mentioned that the publishRemove has to take place from the relay originator.<br>
<br><br>Cheers<br>Dimitris<br><br><br><br><br><div><span class="gmail_quote">On 26/03/2008, <b class="gmail_sendername">Todd Wright</b> <<a href="mailto:twright@bbn.com">twright@bbn.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br> Plugins must use publishRemove to cleanup publishAdd'ed objects.<br> <br> The ping demo uses the following pattern:<br> 1. The "PingSender" publishAdd's a new relay<br> 2. The "PingReceiver" publishChange's the relay to send back a response<br>
3. The "PingSender" publishRemove's its relay<br> 4. goto (1)<br> So, every ping iteration creates a new relay and removes it. We cleanup after<br> every iteration. Note that the relay must be publishRemove'd on the agent<br>
where it was publishAdd'ed.<br> <br> Another common pattern is:<br> 1. The sender publishAdd's a new relay "r1"<br> 2. The receiver publishAdd's its response in a new relay "r2"<br> 3. The sender publishChange's relay "r1" in response to "r2"<br>
4. The receiver publishChange's relay "r2" in response to "r1"<br> 5. goto (3)<br> In this pattern the two relays, "r1" and "r2", acts as content "channels".<br> There is no memory leak because we only publishAdd these two relays.<br>
<br> There are advantages and disadvantages to both of these design patterns.<br> Either works fine in practice.<br> <br> Todd<br> <br><br> Dimitrios Traskas wrote:<br> > Hi to all,<br> ><br> > I have a question in regards with Relays and objects in the Blackboard.<br>
> If an Agent A has an established communication with an Agent B and they<br> > send to each other a number of messages what happens with messages that<br> > have been read and processed? Are they "garbage" collected or is it the<br>
> responsibility of client code to get rid of them? I have thousand of<br> > messages being sent between Agents and I am wondering what happens once<br> > I go through a normal execute routine where I check the added messages<br>
> in a collection. Once I read the message what is the lifetime of that<br> > message?<br> ><br> ><br> > Cheers<br> > Dimitris<br> ><br> ><br> <br>> ------------------------------------------------------------------------<br>
><br> > _______________________________________________<br> > Cougaar-developers mailing list<br> > <a href="mailto:Cougaar-developers@cougaar.org">Cougaar-developers@cougaar.org</a><br> > <a href="http://cougaar.org/mailman/listinfo/cougaar-developers">http://cougaar.org/mailman/listinfo/cougaar-developers</a><br>
</blockquote></div><br>