Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Context close

 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Trimoorthy Kotte
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic