users@glassfish.java.net

Re: JMS Session Creation Hanging When Message Producer Not Available

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Fri, 07 Sep 2012 12:50:59 +0100

On 07/09/2012 08:57, forums_at_java.net wrote:
> Morning All, We are running GlassFish in a two node clustered environment
> with Open MQ as our message broker and whilst doing some resiliance testing,
> we have spotted that when the message broker is not available, the following
> line of code hangs on JMS session creation? Session session =
> connection.createSession(true, Session.AUTO_ACKNOWLEDGE); We have tried
> setting the following activation specification property to get it to fail
> after a given period of time but the session creation continues to hand
> indefinately when the message consumer is not available ...
> @ActivationConfigProperty(propertyName = "maxWaitTime", propertyValue = "5"),
> Is there a better way to handle the scenario when the message producer is not
> available? Thanks in advance for any help! Chris. GlassFish 3.1.2.2 (build 5)
> Open MQ 4.5.2 Patch 1 (Build 3-d)

Sounds like MQ is trying to reconnect. If you are trying to force the reconnection to give up sooner, try changing the
reconnectAttempts and reconnectInterval properties of the activation spec and of the connection factory. You can also
set these globally on the resource adapter.

http://docs.oracle.com/cd/E26576_01/doc.312/e24943/jmsra-properties.htm#aeoop
The default values mentioned there appear to be overridden by different values from GlassFish: if I look at the admin
console (Java message Service tab) I see the default reconnectEnabled=true, reconnectAttempts=3 and reconnectInterval=5
secs. Have you set larger values?

Nigel