Re: JMS connection issues

Tim Anderson <[email protected]> Sat, 28 Apr 2007 16:51:44 +1000
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
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

-------------------------------------------------------------------------
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