Fwd: Issue when using agent mobility in Cougaar
daniel domingue
ddomingue at gmail.com
Tue Jun 24 08:06:58 EDT 2008
I'm trying a second attempt at the mailing list
---------- Forwarded message ----------
From: daniel domingue <ddomingue at gmail.com>
Date: Fri, Jun 20, 2008 at 5:07 PM
Subject: Issue when using agent mobility in Cougaar
To: cougaar-developers at cougaar.org
Hello all,
I have encountered a small problem when trying to use mobile agents.
The relocated agents have an IncrementalSubscription on message
elements in the blackboard which contain a specific object.
Mobility is triggered by a remote agent using the following code :
/* get a ticket identification from the mobility factory */
Object ticketId = mobilityFactory.createTicketIdentifier();
/* get adresses of agent and host */
MessageAddress agentAdd =
MessageAddress.getMessageAddress(agentName);
MessageAddress origHostAdd =
MessageAddress.getMessageAddress(origHost);
/* create a transfer ticket with the needed information */
Ticket mTicket = new
Ticket(ticketId,agentAdd,origHostAdd,this.nodeId,false);
/* create a move agent order with the created ticket */
MoveAgent ac = mobilityFactory.createMoveAgent(mTicket);
/* post the ticket to the blackboard for proceeding */
blackboard.publishAdd(ac);
Everything works fine except that the relocated agents receive old
messages through the getAddedCollection() performed in the execute()
method after the blackboard has been rehydrated.
Below is part of the code that filters the messages in the relocated agents :
for (Iterator iter = aValMsgSubs.getAddedCollection().iterator();
iter.hasNext();)
{
LS_Com_Target co = (LS_Com_Target) iter.next() ;
Object o = co.getData();
Msg_LBValidator m = ((Msg_LBValidator) o);
/* placebo */
switch(m.getLoadType())
{
case(ScenarioEntry.MSG):
loadinfo.setRemainingMSGLoadCycles(m.getElapsed());
loadinfo.setMsgTargets(m.getTargetAgents());
System.out.println(this.agentId.toString()+"
received MSG");
break;
case(ScenarioEntry.PROC):
loadinfo.setRemainingCPULoadCycles(m.getElapsed());
System.out.println(this.agentId.toString()+"
received PROC");
break;
case(ScenarioEntry.SIZE):
loadinfo.setRemainingMEMLoadCycles(m.getElapsed());
System.out.println(this.agentId.toString()+"
received SIZE");
break;
}
modified=true;
}
The problem I see is that when the blackboard is being rehydrated all
the old messages change state and are classified as new messages,
which are picked up at the first execute() call after the load().
Any clue that could help would be appreciated!
Thanks in advance,
--
Daniel Domingue
--
Daniel Domingue
More information about the Cougaar-developers
mailing list