users@glassfish.java.net

Re: JMS resources in SLSB - bean not removed from pool on RuntimeException

From: <glassfish_at_javadesktop.org>
Date: Tue, 02 Jun 2009 03:04:31 PDT

Anybody?

I'm using Glassfish v2.1 on Kubuntu Linux 8.04.1

I have now attached my EJB and test case so maybe someone can reproduce this on their side.

Summary from the tests:
The ConnectionFactory is injected, then a QueueSession and QueueConnection is created. At the end of testMethod an Exception is thrown. The method is called 250 times.

Here are the different tests that I have done:
a) throw an Exception that is annotated with @ApplicationException( rollback = true).
     outcome: 1 instance of TestEJB (which is good), 250 DirectQueueSessions, a re-run of the test is not possible since there are no more free connections on the ConnectionFactory

b) throw an EJBException (RuntimeException)
     outcome: 250 instances of TestEJB (argh), 250 DirectQueueSessions, re-run not possible since no more free connections

c) throw EJBException and do resource cleanup (i.e. close QueueSession)
     outcome: 1 instance of TestEJB, 1 DirectQueueSession


My understanding has always been that a RuntimeException renders the EJB useless and therefore should be destructed by the container. But case b) says otherwise. Moreover, I would want that the references to the QueueSessions and the QueueSessions itself get destructed as well, otherwise I cannot open new JMS connections in GlassFish which is very bad.

Can someone please comment? I'd really appreciate that.

Thanks,
Chris.
[Message sent by forum member 'chrjohn' (chrjohn)]

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