I am using tomcat 4 and jboss 3.0.2. In my servlet i get a message from MDB. My code works fine and i dont get any kind of exceptions. i close my queue receiver, queue session and queue connection successfuly. 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();
-----------------------------------
Any help would be appreciated.
I have found something. If i switch from RMIConnectionFactory to ConnectionFactory everything works fine. With RMIConnectionFactory some thread keep alive even after calling close. Is this a bug in RMIConnectionFactory or i am doing something wrong.