Relay - Blackboard Economics

Todd Wright twright at bbn.com
Wed Mar 26 18:13:52 EDT 2008


Plugins must use publishRemove to cleanup publishAdd'ed objects.

The ping demo uses the following pattern:
   1. The "PingSender" publishAdd's a new relay
   2. The "PingReceiver" publishChange's the relay to send back a response
   3. The "PingSender" publishRemove's its relay
   4. goto (1)
So, every ping iteration creates a new relay and removes it.  We cleanup after 
every iteration.  Note that the relay must be publishRemove'd on the agent 
where it was publishAdd'ed.

Another common pattern is:
   1. The sender publishAdd's a new relay "r1"
   2. The receiver publishAdd's its response in a new relay "r2"
   3. The sender publishChange's relay "r1" in response to "r2"
   4. The receiver publishChange's relay "r2" in response to "r1"
   5. goto (3)
In this pattern the two relays, "r1" and "r2", acts as content "channels". 
There is no memory leak because we only publishAdd these two relays.

There are advantages and disadvantages to both of these design patterns. 
Either works fine in practice.

Todd

Dimitrios Traskas wrote:
> Hi to all,
> 
> I have a question in regards with Relays and objects in the Blackboard. 
> If an Agent A has an established communication with an Agent B and they 
> send to each other a number of messages what happens with messages that 
> have been read and processed? Are they "garbage" collected or is it the 
> responsibility of client code to get rid of them? I have thousand of 
> messages being sent between Agents and I am wondering what happens once 
> I go through a normal execute routine where I check the added messages 
> in a collection. Once I read the message what is the lifetime of that 
> message?
> 
> 
> Cheers
> Dimitris
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Cougaar-developers mailing list
> Cougaar-developers at cougaar.org
> http://cougaar.org/mailman/listinfo/cougaar-developers



More information about the Cougaar-developers mailing list