Re: JMS connection issues

"Govinda Rao Deyyam" <[email protected]> Sat, 28 Apr 2007 16:30:31 +0530
Newsgroups gmane.comp.java.openjms.user
Message-ID <CAE7CE4D34AA7848816555DF1ED16D27025A6066@MYSHECMSG01.ad.infosys.com>
Hi Tim,

 

Thanks for your reply. But still I am not clear with your answers.

>From your first statement, you mean a new connection object will be
created but will be given to the same address location ...am I correct?
How is it happening...how come the same address will be given for the
next object? You mean when we close the Sender program the connection
object or address is not getting freed from the memory....is it? In this
case if I run a Receiver program followed by Sender program then the
same address should be given for the connection object created in
Receiver program, but not happening. Who is allocating address and
creating connection objects in this case?

 

Can you explain the below question?

1.	Run a Sender program and the address is abcd@abcd
2.	run a Receiver program and the address is wxyz@xyz
3.	run the sender program again but got the same address abcd@abcd

4.	run the sender program again but got the same address wxyz@xyz

How am I getting the same address for a particular program ...how is
this mapping happening?

 

your second statement "If you create an instance of another object prior
to the creation of the connection you should see the connection address
change "is not clear to me.

In my examples I am running the sender program second time means I am
creating instance of the Sender freshly who creates a connection object.
In this case there should be new address. 

 

My second issue: The firewall is closing the connection after some
inactive time (got confirmed). So we have coded that when ever we get a
IllegalStateException or JMSException then creating new connection.

 

Thanks

Govind

 

________________________________

From: openjms-user-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:openjms-user-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Tim
Anderson
Sent: Saturday, April 28, 2007 12:22 PM
To: [email protected]
Subject: Re: [openjms-user] JMS connection issues

 

See inline:

Govinda Rao Deyyam wrote: 

Dear Users,

 

I have few queries on JMS connection mechanism.

 

I have tried running the example programs (SimpleReceiver, SimpleSender)
and found a strange thing. 

I am printing the connection object after getting the connection from
the factory object, code given below

 

QueueConnectionFactory factory = (QueueConnectionFactory)
context.lookup(factoryName);

                QueueConnection connection =
factory.createQueueConnection();

                connection.start();

System.out.println("connection is : "+connection);

 

But I am getting the same connection object every time when I run this
program, given the results below. When the program is closed the objects
instantiated by that program should also be freed and when we run the
program next time new objects should be created but its not happening in
this case.

Example, same object is getting returned for the SenderProgram every
time we run, same object getting returned for Receiver program every
time we run. But the object is different for sender and receiver
programs (have highlighted below).

 

Even if I close the connection at the end of the program the same object
is getting returned when I run the program second, third..etc times.

 

Coud anyone please explain this funda?


It just means that the connection object is being allocated to the same
address each time the program is run.
If you create an instance of another object prior to the creation of the
connection you should see the connection address change.




 

 

Sender program:

E:\openjms-0.7.5\src\examples\openjms\examples\client\console>java -cp
%classpath% openjms.examples.client.console.SimpleSender -queue request2


-mode tcp -jndiport 3055 -jndihost localhost -count 1

connection is : org.exolab.jms.client.JmsQueueConnection@6b7920

Publishing org.exolab.jms.message.BytesMessageImpl@1cdeff

 

E:\openjms-0.7.5\src\examples\openjms\examples\client\console>java -cp
%classpath% openjms.examples.client.console.SimpleSender -queue request2

 -mode tcp -jndiport 3055 -jndihost localhost -count 1

connection is : org.exolab.jms.client.JmsQueueConnection@6b7920

Publishing org.exolab.jms.message.BytesMessageImpl@1cdeff

 

E:\openjms-0.7.5\src\examples\openjms\examples\client\console>java -cp
%classpath% openjms.examples.client.console.SimpleSender -queue request2

 -mode tcp -jndiport 3055 -jndihost localhost -count 1

connection is : org.exolab.jms.client.JmsQueueConnection@6b7920

Publishing org.exolab.jms.message.BytesMessageImpl@1cdeff

 

 

Receiver Program:

E:\openjms-0.7.5\src\examples\openjms\examples\client\console>java -cp
%classpath% openjms.examples.client.console.SimpleReceiver -queue
request2 

-mode tcp -jndiport 3055 -jndihost localhost -count 1

connection is : org.exolab.jms.client.JmsQueueConnection@63b895

 [1 of 1] ObjectMessage JMSDeliveryMode=PERSISTENT, Priority=4,
JMSMessageID=ID:4734191357462726621

 

E:\openjms-0.7.5\src\examples\openjms\examples\client\console>java -cp
%classpath% openjms.examples.client.console.SimpleReceiver -queue
request2 

-mode tcp -jndiport 3055 -jndihost localhost -count 1

connection is : org.exolab.jms.client.JmsQueueConnection@63b895

 [1 of 1] ObjectMessage JMSDeliveryMode=PERSISTENT, Priority=4,
JMSMessageID=ID:2767882215716415820

 

E:\openjms-0.7.5\src\examples\openjms\examples\client\console>java -cp
%classpath% openjms.examples.client.console.SimpleReceiver -queue
request2 

-mode tcp -jndiport 3055 -jndihost localhost -count 1

connection is : org.exolab.jms.client.JmsQueueConnection@63b895

 [1 of 1] ObjectMessage JMSDeliveryMode=PERSISTENT, Priority=4,
JMSMessageID=ID:2767882215716415819

 

 

 

Q2. Is there any possibility that JMS Server closes the connection after
some inactive time (might be configurable)?

            We are currently facing one problem where the connection is
getting closed after some inactive time; we are suspecting that firewall
is closing this connection, due to this we are getting
illegalStateException when we call any operation on the connection
object.

 

Whats the stack trace?




I appreciate the earliest response.

 

Thanks & Regards

Govinda Rao

 

-Tim



**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
openjms-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openjms-user