View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3821319#3821319

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3821319

I am developing a JMS application on JBoss. I have a Queue, which I post messages to, 
from a custom MBean, to be received by an MDB running in a J2EE application in the 
same JBoss server.



My problem is that I can't close the JMS connections I use, even though i call close() 
on the JMS Session and Connection, so the system eventually runs out of JMS 
connections in its pool (I can see this with the jboss.jca.ManagedConnectionPool 
MBean, named JmsXA)



Since I'm running in the MBean, I have to create a UserTransaction before I put a 
message on the queue, otherwise it complains about an invalid TransactionId. This 
works - don't know if it's relavent.



My code is roughly this (- the exception handling):



  private QueueConnectionFactory qFactory = null;

  private QueueConnection qConnect = null;

  private QueueSession qSendSession = null;

  private QueueSender qSender = null;



// Create a QueueSender



      InitialContext jndi = new InitialContext();

      qFactory = (QueueConnectionFactory)jndi.lookup(JMS_FACTORY);

      qConnect = qFactory.createQueueConnection();

      qSendSession = qConnect.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);    
// transactional



      queue = (Queue)jndi.lookup("myQueueName");

      qSender = qSendSession.createSender(queue);



// Use the sender



// Close the session and connection 



  if(qSender != null)qSender.close();

  if(qConnect != null)qConnect.close();



Does anyone know what I have to do to release/destroy the connection? The connection 
pool MBean says that I haven't "destroyed" and connections, and 20 are in use when it 
runs out



Thanks - John








-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to