The following test client confirms that simply closing a Connection will not delete any
created temporary queues. Performed w/ JBM 1.3 and EAP 4.2. This example requires the
consumer be closed and the temp Q explicitly deleted to cause removal of the temp Q. This
conflicts with JEE JavaDoc, which states that closing the connection will remove temporary
queues.
Further, if the connection is simply closed, the temp Q appears to be a permanent resource
leak within the broker (confirmed w/ JNDIView).
Please advise. If the answer is "move to 1.4", please confirm that this issue
is resolved in 1.4...I am unable to find any info in the JIRA.
package com.cisco.nm.comet.api.test;
|
| import javax.jms.Connection;
| import javax.jms.ConnectionFactory;
| import javax.jms.JMSException;
| import javax.jms.MessageConsumer;
| import javax.jms.MessageProducer;
| import javax.jms.Queue;
| import javax.jms.Session;
| import javax.jms.TemporaryQueue;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
|
| public class JMSTempQDelete
| {
| private static final String requestQueueName =
"queue/cduRequestRouterQueue";
|
| public static void main(String args[])
| {
| try
| {
| // Get the JNDI context.
| //
| InitialContext ctx = new InitialContext();
|
| // Lookup the connection factory and create connection.
| //
| ConnectionFactory factory =
(ConnectionFactory)ctx.lookup("ConnectionFactory");
| Connection connection = factory.createConnection();
|
| // Create the response session, temp reply Q, and response consumer.
| //
| Session responseSession = connection.createSession(false,
| Session.AUTO_ACKNOWLEDGE);
| TemporaryQueue responseQueue = responseSession.createTemporaryQueue();
| MessageConsumer consumer = responseSession.createConsumer(responseQueue);
|
| // JBM 1.3. It is neccessary to close consumer and explicitly
| // delete temp Q to remove the temp Q from the broker.
| //
| // This conflicts with info at
http://java.sun.com/javaee/5/docs/api/ ...
| // "Closing a connection causes all temporary destinations to be
deleted"
| //
| consumer.close();
| responseQueue.delete();
|
| connection.stop();
| connection.close();
| }
| catch (NamingException e)
| {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| catch (JMSException e)
| {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115592#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...