How do I destroy a TemporaryQueue on the server?
yurifyurif Aug 24, 2004 3:15 PMI create a temporary queue for each new client connecting to my "server" (a service running in JBoss). On the server side, I call
TemporaryQueue q = qsession.createTemporaryQueue();
and than pass the value of
tempQueueTopic = q.getQueueName ();
back to the client.
The client than calls
Queue queue = qsession.createQueue (tempQueueTopic);
to connect to the same queue.
The question is how/when does this temp queue get destroyed? Specifically, let's consider using JMS over HTTP (using HTTPServerILServlet). Suppose a client has conencted to the temp queue above and then termined ungracefully (without closing the connection). What I'm seeing is that somehow the sevlet is holding on to this JMS connection such that if I attempt to call TemporaryQueue.delete() on the server (after closing all server-side senders/receivers for this queue) I get the following exception:
org.jboss.mq.SpyJMSException: Cannot delete the TemporaryQueue; - nested throwable: (org.jboss.mq.SpyJMSException: Cannot delete the TemporaryDestination; - nested throwable: (javax.jms.JMSExcept
ion: Cannot delete temporary queue, it is in use.))
at org.jboss.mq.SpyTemporaryQueue.delete(SpyTemporaryQueue.java:73)
...
Caused by: javax.jms.JMSException: Cannot delete temporary queue, it is in use.
at org.jboss.mq.server.JMSDestinationManager.deleteTemporaryDestination(JMSDestinationManager.java:715)
at org.jboss.mq.server.JMSServerInterceptorSupport.deleteTemporaryDestination(JMSServerInterceptorSupport.java:174)
at org.jboss.mq.security.ServerSecurityInterceptor.deleteTemporaryDestination(ServerSecurityInterceptor.java:217)
at org.jboss.mq.server.TracingInterceptor.deleteTemporaryDestination(TracingInterceptor.java:396)
at org.jboss.mq.server.JMSServerInvoker.deleteTemporaryDestination(JMSServerInvoker.java:174)
at org.jboss.mq.il.jvm.JVMServerIL.deleteTemporaryDestination(JVMServerIL.java:177)
at org.jboss.mq.Connection.deleteTemporaryDestination(Connection.java:483)
... 52 more
So, essentially what I'm asking is
1. Should I call tempQueue.delete () at all, or simply close all senders/receivers and hope that some sort of reference counting mechanism will destroy the queue?
2. With HTTP IL, will the proxy sender/receiver be closed automatically when the client just dies without closing the session explicitely?
Thanks,
Yuri