Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Strange behavior with QueueBrowser

922859Mar 9 2012 — edited Mar 9 2012
Hi,

I am using a QueueBrowser along with a QueueReceiver for my application and notice behavior that is strange. Here is the logic :

a) I create a QueueBrowser against a queue and take a snapshot of whats on the queue.
b) I loop through the enumeration of messages on the queue and determine for each message , if the message is ready to be processed now(based on some logic).
c) If in step (b), i determine that the message is ready to be processed, i create a runnable and submit the runnable to a thread pool for processing.
d) The runnable uses a queue receiver to receive a specific message off the queue using a message selector and processes the message.

What i notice is if the receiver tries to receive a message that the browser has already seen, at times the receive method returns null. But eventually after many failed attempts, the receiver can pull the message off the queue using the message selector. Also, i notice that when the receive timeout is set to NO_WAIT,
the receive call fails before succeeding eventually. But if i use the receive method with a couple of seconds timeout, it does seem to receive successfully every time.

Any thoughts on why this behavior would happen?

Raj

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 6 2012
Added on Mar 9 2012
3 comments
1,885 views