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


Subject: RE: [jade-develop] Agent creation error ???
From: BROUCHOUD Henri FTRD/DIH/LAN (henri.brouchoud@rd.francetelecom.com)
Date: Thu Oct 03 2002 - 12:24:00 MET DST


Humm ... I am not happy whith both solutions.

I think I have a better one (for Jade 2.61) :
I can call
        agentContainer.getAgent(someName);
on the container before creating my agent, if this call succeeds, the agent name is
already used and I will have a name clash.
It solves only a name clash problem, if the agent creation failed for some other
reason, the error will not be reported to my code.

Thanks Fabio

Henri

> -----Message d'origine-----
> De : Bellifemine Fabio [mailto:Fabio.Bellifemine@TILAB.COM]
> Envoyé : mercredi 2 octobre 2002 15:52
> À : BROUCHOUD Henri FTRD/DIH/LAN; jade-develop@sharon.cselt.it
> Objet : RE: [jade-develop] Agent creation error ???
>
>
> 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 : Thu Oct 03 2002 - 12:24:09 MET DST