am using tomcat 4 and jboss 3.0.2. In my servlet i get a message from MDB. My code works fine and I don’t get any kind of exceptions. I close my queue receiver, queue session and queue connection successfully. When I try to shutdown tomcat I still have some threads running which keeps tomcat from shutting down. I printed that thread and here is the info.
Thread Name=Connection Monitor Thread
Alive=true
isDaemon=true
groupName =JBossMQ Client Threads
parentGroup=main
Here is the code in my servlet
QueueConnection qc = null;
QueueSession qs = null;
Queue rq = null;
QueueReceiver qr = null;
Message m = null;
InitialContext ic = null;
try {
ic = new InitialContext();
} catch (Exception e) {
e.printStackTrace();
}
Object cfo = null;
try {
cfo = ic.lookup("RMIConnectionFactory");
} catch (NamingException e) {
e.printStackTrace();
}
QueueConnectionFactory qcf = (QueueConnectionFactory) cfo;
qc = qcf .createQueueConnection();
rq = (Queue) ic.lookup(MyConstants.USER_QUEUE);
qs = qc.createQueueSession(false,QueueSession.CLIENT_ACKNOWLEDGE);
qc.start();
String selector = "myproperty like b";
qr = qs.createReceiver(rq,selector);
m = qr.receiveNoWait();
qr.close();
qs.close();
qc.stop();
qc.close();