dcsimg
how exactly the setListener() works?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sanjay_Jeurkar
Posted On:   Tuesday, August 28, 2001 01:19 AM

My server is running on machine1. We have a class Test which implements MessageListener on another machine2. /****************/ import java.io.*; import javax.jms.*; public class Test implements MessageListener ,Serializable { Test() { System.out.println("in test()"); } public void onMessage(javax.jms.Message message) { System.out.println("in onMessage of brijesh machine()"); } } /********************************/ and a receiver programme which is also running on machine2 . The test is set for this listener. /******   More>>

My server is running on machine1.

We have a class Test which implements MessageListener on another machine2.


			
/****************/
import java.io.*;
import javax.jms.*;
public class Test implements MessageListener ,Serializable
{
Test()
{
System.out.println("in test()");
}

public void onMessage(javax.jms.Message message)
{
System.out.println("in onMessage of brijesh machine()");
}

}
/********************************/


and a receiver programme which is also running on machine2 . The test is set for this listener.



			
/*********/
Test test = new Test();
receiver.setMessageListener(test);
/**************/


I want to know how the JMS server hand over the message object to the particular messageListener(test).

The server must be having either the test with it or a referance of the test on machine2.

So how the messge listener(test) object is passed to the server , by referance or by value?

The System.out.println statement in the onMessage() of test t gets printed on the machine2.
I guess if it is passed by value then print statement should be get printed on machine1
and if it is passed by referance then it should be get printed on machine2 .
But from the source code I could not get any clue so as to How it is being passed by referance?

So could anybody tell me how exactly the setListener() works?

   <<Less
About | Sitemap | Contact