users@glassfish.java.net

Re: JMS connection

From: Danilo Levantesi <danilo.levantesi_at_gmail.com>
Date: Mon, 22 Jun 2009 12:54:31 +0200

Hi Chris,

many thanks for your reply. I'm just refactoring the code following your
suggestion. ;)

BTW, after some tests, I "can" confirm that the connection is not closed as
soon as the close() method is called (I need further investigation to
understand if it is closed after the method call or after the SLSB is
destroyed).

I don't know if it is the expected behaviour, but it helped me to find a
more-than-few-lines of optimizable code :)

Thank you

Danilo

> Hi Danilo,
>
> > I found a temporaly work around, but I don't really
> > like it ;(
> >
> > The problem is that I have only one producer instance
> > (it is a single SLSB)
> > that sends a bunch (say some hundreds) of JMS
> > messages to a topic, and for
> > each message opens a connection (maybe this is the
> > source of the problem) and
> > then closes (not very optimized, but it should work,
> > shouldn't it?).
>
> Yes, it should work, but as you noted it is not very efficient. Why do you
> open a new connection for each message? If you send some hundreds of
> messages through the same SLSB you should open the connection only once.
> E.g. you could create it in the @PostConstruct method and close it in the
> @PreDestroy method.
>
> Cheers
> Chris.
> [Message sent by forum member 'chrjohn' (chrjohn)]
>
> http://forums.java.net/jive/thread.jspa?messageID=352307
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net