users@glassfish.java.net

JMS resources in SLSB - bean not removed from pool on Exception

From: <glassfish_at_javadesktop.org>
Date: Mon, 25 May 2009 07:26:30 PDT

Hi,

I got a stateless session bean that opens a JMS connection. Now assume that there is a RuntimeException during one method call of the EJB. The bean itself then doesn't seem to get removed from the pool so that the JMS resources are freed. I have verified this with "jmap -histo:live".
In my example I can start the bean 250 times until the ConnectionFactory doesn't accept connections anymore (250 is the default number of connections).

My test case just throws an EJBException at the end of a method to test this behaviour. Now, if I close all JMS resources before throwing the Exception, everything is fine. So the question is: when can I expect the beans to be removed from the pool? Is this the idle-timeout of a JMS connection that is responsible for such a long wait time?

The other question is why 250 SLSBs get created, looking at domain.xml I would think that the default maximum pool size is 32.

What could I do to prevent this long wait time? I'd rather not go through all the code and catch RuntimeExceptions in every method and bean that uses JMS just to close the JMS resources there to have the beans returned to the pool at once.

Thanks in advance for your suggestions,
Chris
[Message sent by forum member 'chrjohn' (chrjohn)]

http://forums.java.net/jive/thread.jspa?messageID=347558