users@glassfish.java.net

Re: Strange JMS behaviour

From: <forums_at_java.net>
Date: Tue, 15 Mar 2011 00:06:26 -0500 (CDT)

You've called receiveNoWait, which according to the Javadocs is defined to
"receive the next message if one is immediately available" and to return null
if one isn't.

This means that a call to this method will return null if the client would
need to fetch the message from a remote broker (which it does it its
client-side cache is empty), since that would take some time and so would not
be "immediate". 

I would advise never using receiveNoWait since it makes your program behave
differently depending on whether the message is already cached on the client
or not.

 

Nigel

 


--
[Message sent by forum member 'nigeldeakin']
View Post: http://forums.java.net/node/781328