using: jboss 4.0.3SP1 (on linux) and 4.0.4 and 4.0.5 GAs (on winxp)
I have configured a MDB to be a singleton as instructed in the FAQ, with the
<configuration-name>Singleton Message Driven Bean</configuration-name>
directive in jboss.xml .
When configured so, that MDB is being run in max. two threads in parallel, instead of one.
If I remove the singleton configuration, it starts to use up to X threads.
As a test case I have a MDB that receives messages from a queue, and waits 10 seconds as
to simulate long-running processing, and prints Thread.currentThread.getId() before and
after that loop. The messages are sent by a Quartz job, but I think that is irrelevant
because only thing that matters for MDB execution is that messages are put to the queue.
Debug output from a test case shows that even tho configured as a singleton it runs in two
parallel threads. In this example I use a test servlet to quickly schedule 3 message
sendings to occur after 1 second, and then we see that two threads are used to execute
those commands:
15:31:11,734 INFO [STDOUT] Scheduling Job ..
| 15:31:12,218 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:31:12,234 INFO [STDOUT] Scheduling Job ..
| 15:31:12,234 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:31:12,328 INFO [STDOUT] Scheduling Job ..
| 15:31:12,328 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:31:12,906 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 70
| 15:31:13,593 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 37
| 15:31:22,906 INFO [TaskexecCommandRunnerBean] .. done in thread 70
| 15:31:22,921 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 70
| 15:31:23,593 INFO [TaskexecCommandRunnerBean] .. done in thread 37
| 15:31:32,921 INFO [TaskexecCommandRunnerBean] .. done in thread 70
|
When I change nothing else, but comment out the singleton config (<!--
configuration-name>Singleton Message Driven Bean</configuration-name-->),
redeploy and execute the same thing, the behaviour changes correctly. In this example I
schedule 5 executions, and they are all executed in parallel in their own threads:
| 15:41:32,609 INFO [STDOUT] Scheduling Job ..
| 15:41:32,625 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:32,906 INFO [STDOUT] Scheduling Job ..
| 15:41:32,906 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:33,296 INFO [STDOUT] Scheduling Job ..
| 15:41:33,296 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:33,609 INFO [STDOUT] Scheduling Job ..
| 15:41:33,625 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:33,750 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 109
| 15:41:33,984 INFO [STDOUT] Scheduling Job ..
| 15:41:33,984 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:34,015 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 118
| 15:41:34,359 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 127
| 15:41:34,875 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 136
| 15:41:35,046 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10
secs) in thread 145
| 15:41:43,750 INFO [TaskexecCommandRunnerBean] .. done in thread 109
| 15:41:44,015 INFO [TaskexecCommandRunnerBean] .. done in thread 118
| 15:41:44,359 INFO [TaskexecCommandRunnerBean] .. done in thread 127
| 15:41:44,875 INFO [TaskexecCommandRunnerBean] .. done in thread 136
| 15:41:45,046 INFO [TaskexecCommandRunnerBean] .. done in thread 145
|
Am I overlooking / misunderstanding something, or is this a bug?
One reason why I did not post this as a bug report (yet) is that there seems to be a known
issue with EJB3 and JMS producing similar behaviour,
http://jira.jboss.org/jira/browse/JBAS-3327 "maxSessions=1 in JMS activation spec
creates multiple MDBs" and that bug report is closed as 'wont fix' because of
some on-going work with ejb3s or something (i did not read the discussion too closely).
Can it be that this is resulting from that known jboss issue, even though I am not using
EJB3? The linux server here with 4.0.3 SP1 produces the same behaviour even though it does
not have ejb3 things installed. On a development winxp laptop I have reproduced this with
both 4.0.4 and 4.0.5 GAs, without ejb3.
When using EJB3 and the @ActivationConfigProperty(propertyName = "MaxSession",
propertyValue = "1") I get what JBAS-3327 describes, i.e. 2 threads (and n+1
with other values). And yes I tried putting a 0 there too which resulted in no MDBs being
invoked :) (after reading the discussion regarding the bug i know why)
Is this a known issue? I could not find any solution on this forum or elsewhere. Is there
anything I can do to make it working, is it working correctly for others?
hoping that the question / report is clear,
~Toni
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991289#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...