users@glassfish.java.net

Re: JMS connection

From: Danilo Levantesi <danilo.levantesi_at_gmail.com>
Date: Mon, 22 Jun 2009 11:04:04 +0200

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?).

The workaround was to increment the value of "Maximum Pool Size" of the
ConnectionFactory to a value greater than the supposed number of connection
(for example, if I suppose to send 100 messages - so 100 connections - the
Maximum Pool Size is set to something greater than 100).

Now I have a doubt: is the connection really closed after the SLSB is
destroyed? or after the SLSB call reaches the end?

> Hi,
>
> connection.close() should be sufficient to close the connection. Do you
> have it in the finally block or in the preDestroy method? The code in the
> first post was not complete, i.e. truncated somehow. Maybe you can post the
> full code snippet again. The things you can try are either to increase the
> max-connections on the connection pool or you could limit the pool size for
> your beans to be lower than the max-connection count on the connection
> factory.
>
> E,g, you could adjust this sun-ejb-jar.xml to fit your needs.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application
> Server 9.0 EJB 3.0//EN"
> "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
> <sun-ejb-jar>
> <enterprise-beans>
> <ejb>
> <ejb-name>SomeBean</ejb-name>
> <jndi-name>queue/SomeBean</jndi-name>
> <bean-pool>
> <steady-pool-size>1</steady-pool-size>
> <resize-quantity>2</resize-quantity>
> <max-pool-size>200</max-pool-size>
> <pool-idle-timeout-in-seconds>600</pool-idle-timeout-in-seconds>
> </bean-pool>
> </ejb>
> </enterprise-beans>
> </sun-ejb-jar>
>
> Cheers
> Chris.
> [Message sent by forum member 'chrjohn' (chrjohn)]
>
> http://forums.java.net/jive/thread.jspa?messageID=352212
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net