users@glassfish.java.net

Re: Message beans and connection limit

From: <glassfish_at_javadesktop.org>
Date: Tue, 27 Jan 2009 00:19:15 PST

> > What You have to check (both in MDB's and JMS
> client
> > code (the one which produces messages)) is whether
> > Connection, MessageProducer, Session and other JMS
> > objects are properly closed.
>
> Excuse my ignorance and i've probably missed
> something simple.
>
> The sender is on another server and doesn't touch the
> db, so am i right in thinking i can ignore it?

Not really. If Your client code (JMS client) is creating and using MessageProducer object and not closing it afterwards , MQ server will not release the resources it has allocated to consume the message. Same thing for Session object. On receiving side, unless You are not continuing sending the message as a replay (creating temporary destinations) or forwarding it to some other queue/topic or using specific acknowledgeMode You don't have to close anything explicitly - as soon as bean has finished processing the message it got from a queue, resources are de-alocated and "bean has returned to the pool" for further message consumption.

/mareks

> also just checked and i do close all used objects in
> PreDestroy as you mentioned
>
> The receiver is setup to get files from this server
> (using an addressList property) and contains just an
> MDB (along with some entity beans).
>
> The MDB class is annotated with
> [i]@MessageDriven[/i], implements
> [i]MessageListener[/i] and only contains one method
> [i]onMessage[/i].
> My confusion stems from this, where would i clean up
> any resources used. Isn't this done for me?
>
> This all seems to stem from the DB being locked for a
> while and the MDBs sitting waiting for it. I'm
> guessing they timeout somewhere and don't release the
> db connection
>
> Any ideas?
>
> Message was edited by: jsl123
[Message sent by forum member 'mareks' (mareks)]

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