users@glassfish.java.net

Re: Findings for “Cannot allocate more connections” exception.

From: <glassfish_at_javadesktop.org>
Date: Tue, 29 Sep 2009 13:51:28 PDT

Hi Nigel

Thanks for you answer. I did go for option 3, i.e. creating a single connection per transaction and then use that connection to send multiple messages and it seems to work.

Anyway, I guess I was slightly fooled by the "Insert Code" functionality in Netbeans which can generate methods for sending a JMS messages. Since the generated methods create an close the connection for each method call you would assume that it would be possible to call those methods multiple times within a single transaction which obviously isn't the case. As far as I remember, I haven't ever seen a note about that the connection may not be returned to the pool even if you call Close on it. Every discussion on this topic seems to assume that Close is not called properly on the connection thus it's leaked some way or another, but hopefully this thread may be of help to others as well.

Regards, Ola
[Message sent by forum member 'glassola' (ola.theander_at_myola.se)]

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