RE: [jade-develop] Agent creation error ???


Subject: RE: [jade-develop] Agent creation error ???
From: Bellifemine Fabio (Fabio.Bellifemine@TILAB.COM)
Date: Wed Oct 02 2002 - 15:52:08 MET DST


Henri, the thread that executes the method acceptNewAgent is different from the thread that executes the actual creation of the agent and that throws the NameClashException. Therefore, it is quite difficult, even if not impossible, to report the exception to the caller. You might try to modify the code yourself and submit to use the modification.

Otherwise, if the application needs to know if the agent creation succedded or not, then I think it is better you use the FIPA-REQUEST protocol and you request the AMS to create the agent.

Ciao, Fabio.

-----Original Message-----
From: BROUCHOUD Henri FTRD/DIH/LAN
[mailto:henri.brouchoud@rd.francetelecom.com]
Sent: 01 October 2002 10:45
To: jade-develop@sharon.cselt.it
Subject: [jade-develop] Agent creation error ???

Hi jaders,

I have to implement an agent that is a factory for other agents. For conceptual reasons
I have to instanciate the agent before starting it within Jade.
The code I use to do that is the following :
        
public class AgentFactory extends jade.core.Agent {
        ...

        MyAgent myAgent = new MyAgent(); // the class MyAgent extends jade.core.Agent
        myAgent._init(/* some stuff*/ );

        jade.wrapper.AgentContainer container = getContainerController();
        jade.wrapper.Agent ac = container.acceptNewAgent(someName, (jade.core.Agent) myAgent);
        ac.start();

        ...

It works ok, except that if I create an agent with a name that is already in use within the platform, Jade writes a beautiful message on the stdout, but I have no way in my code to know if the agent creation succeeded or not. I expected at least to get an exception, or a null return value from acceptNewAgent/createNewAgent.
Moreover, there exist a jade.core.NameClashException, it seems to me that it should be used for this. Am I wrong ?
Is it the right way to create an agent ?

Thanks in advance

Henri

_______________________________________________
jade-develop mailing list
jade-develop@sharon.cselt.it
http://sharon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT http://jade.cselt.it/mailing.htm#unsubscribe

====================================================================
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to MailAdmin@tilab.com. Thank you
====================================================================



This archive was generated by hypermail 2a22 : Wed Oct 02 2002 - 15:52:14 MET DST