Re: [Aglets-developer] Local messaging between two aglets in the sama context is not working ...A
Status: Beta
Brought to you by:
cat4hire
From: Anil K. <akr...@ya...> - 2005-10-16 04:52:08
|
Hi Luca and ALL , As you suggesed i have taken the file com.ibm.aglets.FutureReplyImpl.java from sourceforge,net site and compiled it along withe the other source files i downloaded earlier( from aglets-2.0.2-src.jar) .I overrite this new FutureReplyImpl.java file with the existing one and compiled. I got a compilation error at one import line that syas "import com.ibm.aglet.message.MessageException; " . There is no com.ibm.aglet.message directory at all . So i just removed this "message" directory and used " com.ibm.aglet.MessageException; " and compilation was successful . (Note : you may need to correct this error and upload it again to CVS.) Then i created a new "aglets-2.0.2.jar" with the directories "com.xx.xx and org.xx.xx.xx " I used this new jar file "aglets-2.0.2.jar" while running the application to check for local Mesaging . Now i am not getting any exception like earlier ( Earlier i got com.ibm.aglet.NotHandledException ) , but on the agletB side (where message is being handled ) looks like .. handleMessage( ) is not being called at all. I am noy sure why it is behavving like that . I kept two SOP statements ( please look into the agletB code pasted in the bottom ) in the " public boolean handleMessgae(Message msg){ } " to check whether control is coming to that function or not at all ? Those two statements are not being printed at all. I guess handleMessage() will always be looking for in coming messages once the aglet is initiated. Do we have to explicitly call the handleMessage ()....? I even send around 4 messages thinking that it will give me some clue. But no clue at all. Please help me to know what is happening here. Is the new "com.ibm.aglets.FutureReplyImpl.java" you uploaded causing some other problem solving the cancel method problem...? Following is the out put on Thahithi console ... ------------------------OUTPUT-------------------------- $$$$$$$$$ The new agent ( aglet B) has ID =a330bf4ef9619d66 localProxy is :AgletProxyImpl : Aglet [active] ClassName [baglets.agletB] Identifier[a330bf4ef9619d66] Owner[CN=anilkumar, OU=erl, O=umr, L=rolla, ST=mo, C=us] CodeBase[atp://r24intelsys:4434/] CN=anilkumar, OU=erl, O=umr, L=rolla, ST=mo, C=us Sending a new message again I am aglet B : myID is :a330bf4ef9619d66 Sending a new message again Sending a new message again Sending a new message again Sending a new message again ------------------------OUTPUT------------------------- For your reference i am copying the agletB and agletA code here ... ------------------agletA-----------------------STARTS package baglets; import com.ibm.aglet.*; import java.net.*; public class agletA extends Aglet { public void run() { try { //Get the aglet context AgletContext context = this.getAgletContext(); //Create the agletB instance. AgletProxy localProxy = context.createAglet(null, "baglets.agletB", null); //Save the new aglet ID AgletID loacalID = localProxy.getAgletID(); System.out.println(" $$$$$$$$$$ The new agent ( aglet B) has ID ="+loacalID); try { System.out.println(" localProxy is :"+localProxy); //Send message to the remote agent for(int i=0 ;i<5;i++) { System.out.println(" Sending a new message again"); localProxy.sendMessage(new Message("HELL")); pause(); } } catch(Exception e) { System.out.println("Message is not sent .Exception is :"+e); e.printStackTrace(); } } catch(Exception e ) { System.out.println("Exception is :"+e); } } private static long SLEEP = 2000; private void pause() { try { Thread.sleep(SLEEP); } catch (InterruptedException ie) { } } } -----------------agletA-----------------------ENDS -----------------agletB-----------------------STARTS package baglets; import com.ibm.aglet.*; import java.net.*; public class agletB extends Aglet { public void run() { try { AgletID myID = this.getAgletID(); System.out.println(" I am aglet B : myID is :"+myID); } catch (Exception e) { System.out.println("Exception is :"+e); } } //handle the message. public boolean handleMessgae(Message msg) { System.out.println("I am aglet B . I am at the start of the handleMessgae() "); if( msg.sameKind("HELL")) { System.out.println("I am aglet B .HELLO message received from agletA."); return true; } return false; } } -----------------agletB-----------------------ENDS Please let me know what can i do to find the problem. This simple problem is eating lot of my time. Appreciate your help. Thanks Anil --- Luca Ferrari <cat...@us...> wrote: > Anil Kumar's cat, on 11/10/2005 21.11, walking on > the keyboard wrote: > > Stack trace with local proxy .... Local messaging > . > > ------STARTS > > > > $$$$$$$$$$ The new agent has ID > =e308f78be33d8ad4 > > localProxy is :AgletProxyImpl : Aglet [active] > > ClassName [baglets.agletB] > > Identifier[e308f78be33d8ad4] > > Owner[CN=anilkumar, OU=erl, O=umr, L=rolla, > > ST=mo, C=us] > > CodeBase[atp://r24intelsys:4434/] > > CN=anilkumar, OU=erl, O=umr, L=rolla, ST=mo, C=us > > myID is :e308f78be33d8ad4 > > Message is not sent .Exception is > > :com.ibm.aglet.NotHandledException: [Message : > kind = > > HELLO: arg = {}: priority = 5] > > com.ibm.aglet.NotHandledException: [Message : kind > = > > HELLO: arg = {}: priority = 5] > > at > > com.ibm.aglets.FutureReplyImpl.cancel(Unknown > Source) > I've uploaded a versione of FutureReplyImpl a few days ago that should avoid this problem, since the cancel method is quite rude and raises often the exception. I'm still investigating on the "why" of such implementation. Luca +-------------------------------+ Luca Ferrari cat...@us... The Aglets Project: http://aglets.sourceforge.net +-------------------------------+ __________________________________ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ |