Question about dynamic agent creation during cougaar execution

Todd Wright twright at bbn.com
Mon Jun 4 19:13:21 EDT 2007


daniel domingue wrote:
> Thank you for the information,
> 
> I have been able to obtain a working prototype that enables dynamic
> creation of agents at runtime.
> 
> Reading through the different threads you pointed me towards, I saw
> there were issues with the .xml  specification file when creating many
> different agents .
> 
> I use a simple solution where the agent plugin that creates the new
> agent writes a <agent_name>.xml with the required plugins  in the
> local directory before calling the
> mobilityFactory.createAgentControl(), and the created agent has the
> responsibility to remove the aforementioned file, enabling.
> 
> I would like to know if using this method had any design/performance
> issues, it seems to be working ok for me with acceptable time for the
> whole step of creating an agent with its own .xml file.

Your solution should work fine.  That's currently our best solution.

Long-term, in addition to supporting a per-agent XML file to specify 
each agent's list of plugins, we'd like to support an in-memory data 
structure -based specification.

> 
> Also, in the AddExampleAgentPlugin.java you redirected me to,
> the blackboard.startTransaction() and
> blackboard.closeTransaction() calls were missing around the
>  blackboard.publishAdd(ac);

That shouldn't be necessary.  The above example code is:

   public class AddAgentExamplePlugin extends ComponentPlugin { ...
     protected void setupSubscriptions() {
       ...
       addAgent(newAgent, destNode);
       ...
     }
     protected void execute() {
       ...
     }
     protected void addAgent(String newAgent, String destNode) {
       ...
       blackboard.publishAdd(ac);
       ...
     }
   }

The "setupSubscriptions()" method is always called from inside a 
transaction, so you shouldn't wrap the "publishAdd" within yet another 
transaction.  In fact, I'd expect the extra transaction would cause the 
following an error to be logged:
   ERROR - Opened nested transaction (level=2)

Did you find that you were required to add the above "start/close" 
transaction calls?

Todd

> 
> Thanks again for your time,



More information about the Cougaar-developers mailing list