After OC4J Restart, MDB Instances Not Processing Concurrently Initially (Doc ID 552325.1)

Last updated on JULY 14, 2017

Applies to:

Oracle Containers for J2EE - Version 10.1.3.1.0 and later
Information in this document applies to any platform.
This problem can occur on any platform.

Symptoms

You configure a JMS router so that messages that get delivered to the topic can be routed to a queue that has multiple listeners (i.e multiple instances of the same MDB). The MDB of the queue is configured to have max instances of 30, min instances of 10, and receiver threads of 30.

However, if your application publishes 10 JMS messages to the topic, while you can see 10 messages got routed to the queue, you only see **ONE** MDB instance (that listens to the queue) becomes active. All other MDB instances, though already created, remain idle. Only **AFTER** the first active instance finishes its processing, then other MDB instances start (slowly) to pick up the rest of the messages and begin their own processing.

This behavior is rather peculiar and impedes application performance if the first instance takes a while to finish its task.

Example

+ On OC4J start, I can see that 10 MDB instances are created.

+ I have sent 10 messages to the JMS Topic from my client application and the JMS router has passed the 10 messages from the Topic to the JMS Queue.

+ My MDB onMessage() method, calls sleep for a few seconds and then wakes up to exit the method whenever a message comes from the queue.

+ If you note the log provided below, you can see that only after the thread 1 (MDB instance 1) processes the first message the other threads take up.

+ In the second and third test, you can note that the MDB instances ramp up and all the instances process the messages concurrently.

--------
07/04/11 15:23:03 Start process
--------
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:20 in MDBForQueue.ejbCreate() - Thread OC4J Launcher
07/04/11 15:23:26 Oracle Containers for J2EE 10g (10.1.3.1.0) initialized

First Test (Client sends 10 messages to the JMS Topic):

07/04/11 15:24:21 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:31 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:31 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:31 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:24:41 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:41 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:41 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:24:41 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:24:41 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:24:51 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:51 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:24:51 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:24:51 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:24:51 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-4
07/04/11 15:24:51 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:24:51 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:25:01 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:25:01 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:25:01 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:25:01 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-4

Second Test (Client sends 10 messages to the JMS Topic):

07/04/11 15:28:16 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:28:16 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:28:16 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:28:16 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-4
07/04/11 15:28:26 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:28:26 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:28:26 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-5
07/04/11 15:28:26 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:28:26 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:28:26 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:28:26 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-6
07/04/11 15:28:26 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:28:26 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-7
07/04/11 15:28:26 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-4
07/04/11 15:28:36 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:28:36 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-5
07/04/11 15:28:36 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-6
07/04/11 15:28:36 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:28:36 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:28:36 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-7

Third Test (Client sends 10 messages to the JMS Topic):

07/04/11 15:30:23 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:30:23 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-5
07/04/11 15:30:24 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:30:24 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-6
07/04/11 15:30:24 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:30:24 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-7
07/04/11 15:30:24 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-4
07/04/11 15:30:33 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:30:33 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:30:33 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-8
07/04/11 15:30:33 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-5
07/04/11 15:30:34 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-6
07/04/11 15:30:34 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-1
07/04/11 15:30:34 sleep in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-5
07/04/11 15:30:34 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-2
07/04/11 15:30:34 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-7
07/04/11 15:30:34 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-4
07/04/11 15:30:43 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-3
07/04/11 15:30:43 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-8
07/04/11 15:30:44 wake up in MDBForQueue.onMessage() - Thread WorkExecutorWorkerThread-5

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms