publishChange does not trigger an execute

Michiel Kamermans mkamerma at science.uva.nl
Fri Dec 14 09:32:34 EST 2007


Hi,

I'm using cougaar 12.4 and implemented a very simple agent, using relays 
based on the ones from the pizzaparty demo. When run from the society 
xml I use, one nameserver agent and two of these simple agents are 
created, as well as a jframe button that tells "agent 1" to send an 
object over a relay to "agent 2". these simple agents just look at 
whether they received an object, wait two seconds, and then send a same 
object back - effectively sending one object starts a stream of 
back-and-forth communication.

Problem is, I tried two approaches; in the first I make a new relay a la 
"Relaysource relay = new RelaySource(agentaddress,new Object())" and 
then use blackboard.publishAdd(relay) to have cougaar do all the right 
things and have the RelayTarget created at the target agent. This works 
fine in that a back-and-forth stream keeps going until I kill the JVM.
The second approach fails horribly: instead of making new relays all the 
time, I give the agents a simple "acquaintance" set, which is just a 
HashMap<MessageAddress,RelaySource> so that agents can reuse a one-time 
made relay for each agent that contacts them. For the first message from 
agent 1 to agent 2, all goes well because it doesn't have agent 2 as 
acquaintance yet, so it has to make a new relay and use publishAdd to 
have it added to the blackboard. Then when agent 2 receives the object, 
it also doesn't know agent 1 yet, so when replying it creates a new 
relay to agent 1 and then publishAdds it to the blackboard. Then when 
agent 1 receives this response, things fail. It will retrieve the relay 
from its acquantaince set, change what's on the relay, and then call 
blackboard.publishChange for this relay... and then agent 2's execute() 
method is never called =(

I've put the source code on 
http://pomax.nihongoresources.com/downloads/cougaar with the main class 
being DPNTestClass.java

When I run this (I can't really put all the dependency code online too, 
due to ye olde proprietary silliness) the output is as follows:


COUGAAR 12.0 (JDK1.4) built on Mon Jul 25 08:05:17 CEST 2005
Repository: B12_0JDK1_4 on Mon Jul 25 08:00:06 CEST 2005
VM: JDK 1.6.0_01-b06 (mixed mode)
OS: Windows XP (5.1)
13:12:49,078 SHOUT - XMLComponentInitializerServiceProvider - 
Initializing node "DPN1" from XML file "DPNSociety.xml"
13:12:56,968 WARN  - DirectSysStatSupplier - No handler for Memory on 
platform Windows XP
13:12:56,968 WARN  - DirectSysStatSupplier - No handler for CPU on 
platform Windows XP
13:12:56,968 WARN  - DirectSysStatSupplier - No handler for LoadAverage 
on platform Windows XP
13:12:56,968 WARN  - DirectSysStatSupplier - No handler for Sockets on 
platform Windows XP
13:12:59,046 SHOUT - AssetInitializerServiceComponent - DPN1: Not using 
a database, initializing solely from Files.
13:13:00,921 SHOUT - DPNTestClass - Agent 1: loaded agent...
13:13:01,343 SHOUT - DPNTestClass - Agent 1: StartButtonObject created
13:13:01,453 SHOUT - DPNTestClass - Agent 2: loaded agent...
13:13:01,515 SHOUT - DPNTestClass - Agent 2: StartButtonObject created
13:13:01,609 SHOUT - DPNTestClass - Agent 2: setting up subscriptions
13:13:01,609 SHOUT - DPNTestClass - Agent 1: setting up subscriptions
13:13:01,625 SHOUT - DPNTestClass - Agent 1: calling execute
13:13:01,625 SHOUT - DPNTestClass - Agent 2: calling execute
13:13:01,625 SHOUT - DPNTestClass - Agent 1: calling execute
13:13:01,625 SHOUT - DPNTestClass - Agent 2: calling execute
2007-12-14 01:13:06,546 SHOUT [DOTS] - ............

I then press the button of the StartButtonObject for agent1, which calls 
agent 1's startContainerStream() method

13:14:05,171 SHOUT - DPNTestClass - Agent 1: adding relay to blackboard
2007-12-14 01:14:05,171 SHOUT [DOTS] - +-
13:14:05,203 SHOUT - DPNTestClass - Agent 2: calling execute
13:14:05,203 SHOUT - DPNTestClass - Agent 2: ***
13:14:05,203 SHOUT - DPNTestClass - Agent 2: a new relay was found
13:14:05,203 DEBUG - DPNTestClass - Agent 2: received DPNTestContainer 1 
from Agent 1
2007-12-14 01:14:06,546 SHOUT [DOTS] - .
13:14:07,203 DEBUG - DPNTestClass - Agent 2: sending DPNTestContainer 2 
as response to Agent 1
13:14:07,203 SHOUT - DPNTestClass - Agent 2: adding relay to blackboard
2007-12-14 01:14:07,203 SHOUT [DOTS] - +-
13:14:07,203 SHOUT - DPNTestClass - Agent 1: calling execute
13:14:07,203 SHOUT - DPNTestClass - Agent 1: ***
13:14:07,203 SHOUT - DPNTestClass - Agent 1: a new relay was found
13:14:07,203 DEBUG - DPNTestClass - Agent 1: received DPNTestContainer 2 
from Agent 2
13:14:09,203 DEBUG - DPNTestClass - Agent 1: sending DPNTestContainer 3 
as response to Agent 2
13:14:09,203 SHOUT - DPNTestClass - Agent 1: publishing change on relay
2007-12-14 01:14:09,203 SHOUT [DOTS] - 
+-...........................................................

And no amount of waiting leads to agent 2's execute() being called =(

I hope I just forgot to add something really simple to the relay class 
or publish call (just to make sure I tried adding a changelist 
Collection to publishChange but that didn't help get execute called).

So...  does anyone have any idea what I (clearly) must have done wrong?

Thank you in advance,


- Mike Kamermans
University of Amsterdam



More information about the Cougaar-developers mailing list