aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Context close Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Context close" Watch "Context close" New topic
Author

Context close

Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
Hi one our application we have MDB Bean,

In the ejbCreate I found JMS connection is bind to context object something like this.

ctx.bind(jndiName, MQQueueConnectionFactory);
ctx.bind(queueJndiName, Queue);

Then context is closed by calling the close method.

ejbRemove is kept empty.

In the effort to clean the code (MQ open connection reported in production) we are in the process of closing the MQ connection which are not in use.

Since the scope of queue object is only with in the ejbCreate. Is it valid to close the MQ connection before closing the context?

I am relativity new in the subject, any help would be highly appreciated.


Thanks
Arun
[ March 11, 2008: Message edited by: Arun Boraiah ]

Sharing is learning
Trimoorthy Kotte
Greenhorn

Joined: Mar 31, 2006
Posts: 9
Hi

----------------------
In the ejbCreate I found JMS connection is bind to context object something like this.
ctx.bind(jndiName, MQQueueConnectionFactory);
ctx.bind(queueJndiName, Queue);
----------------------------------------------------------------
I gues you are using MQ as foreign JMS server..
Actually the connection is not bound in the context object. The above code just adds the connectionfactory and queue objects into the jndi tree. These objects are just object representation of queue with out actual connection (MQ queue in case your Messaging middleware is IBM MQ) and connectionafactory (MQ queue manager). When MDB gets deployed the bean makes connection to the MQ queue manager.(hope I am reasonably correct here)
Therefore closing of the MQ Conection does not have any relation with the context.
Closing of MQ connection will not remove the jndi bindings for the queue and connectionfactory.
 
jQuery in Action, 2nd edition
 
subject: Context close