Subject: RE: [jade-develop] Receiving messages
From: Caire Giovanni (Giovanni.Caire@TILAB.COM)
Date: Tue Oct 15 2002 - 12:14:49 MET DST
Hi Alexander,
Personally I strongly discourage the use of blockingReceive() inside a Behaviour as it blocks the whole agent (as you experienced).
The correct way to receive messages within a behaviour is by using receive() in combination with block() as below.
public void action() {
ACLMessage msg = myAgent.receive(...);
if (msg != null) {
// process the message
}
else {
block();
}
}
Note that if you don't block() the behaviour it will eat all your CPU.
Bye
Giovanni
-----Original Message-----
From: Alexander Osherenko [mailto:a.ocherenko@gmx.de]
Sent: marted́ 15 ottobre 2002 11.25
To: JADE
Subject: [jade-develop] Receiving messages
Hello!
My question is - Is it possible to make receiving messages more efficient?
If I use blockingReceive in my behaviours, there are problems with event forwarding in GuiAgents.If I use receive there is no blocking and the events are sent to the onGuiEvent method but the system is working strange - it hangs in the action loops and it is difficult to work with it.
Is there any solution for this problem?
Cheers
Alexander
-----Original Message-----
From: Alexander Osherenko [mailto:a.ocherenko@gmx.de]
Sent: marted́ 15 ottobre 2002 11.25
To: JADE
Subject: [jade-develop] Receiving messagesHello!My question is - Is it possible to make receiving messages more efficient?If I use blockingReceive in my behaviours, there are problems with event forwarding in GuiAgents.If I use receive there is no blocking and the events are sent to the onGuiEvent method but the system is working strange - it hangs in the action loops and it is difficult to work with it.Is there any solution for this problem?CheersAlexander
This archive was generated by hypermail 2a22 : Tue Oct 15 2002 - 12:14:56 MET DST