Jason,

I found the problem which is a classical deadlock. When you receive a 
message in your onMessage method, you do a lookup synchronously without 
spawning a new thread for this or pushing this request into a working 
queue, for example. The router has 1 consumer thread which is marked as a 
short runner. This thread is occupied by your onMessage consumer, waiting 
that the message is consumed which is done by returning from the 
onMessage call. Now you do JNDI lookup which requires also a consumer 
thread for reading the result of the lookup. Because the onMessage 
consumer thread is marked as short runner, no new thread will be created, 
the kernel just waits for the end of this short runner which is blocked. 
Deadlock.

The reason why it works when CLI/Explorer is running is that they need 
additional consumers. These so-called async task are dispatched to the 
jms.consumer pool. The pool dispatcher detects that there are more async 
task requests than running 'short-runner' and creates new threads. These 
threads used by CLI/Explorer are idling after usage and, hence, then used 
by the lookup consumer.

SwiftMQ 1.2c has another more stupid approach as 2.0.0; if a thread was 
required, it creates one when there is no idling thread until the max 
limit is reached. 2.0.0 has some more intelligence but needs a bit more 
for this case. We will fix it in a future patch.

Well, how to resolve this problem for you? You have 2 possibilities:

1. Avoid blocking the onMessage method; do the work asynchronously

2. Specify a threads.min=5 for the jms.consumer pool. Then, 5 threads are 
created initially and they never die. Thus, if you block one with your
onMessage consumer, you have 4 others to serve your requests.

-- 
Andreas Mueller, [EMAIL PROTECTED], IIT GmbH, Bremen/Germany, http://www.iit.de
   SwiftMQ - JMS Enterprise Messaging System, http://www.swiftmq.com    
-----------------------------------------------------------------------
 Cast your vote for SwiftMQ as Best Java Messaging & Middleware Tool:
           QuickVote at: http://www.swiftmq.com/jdjvote.html          
-----------------------------------------------------------------------


------------------------------------------------------
SwiftMQ developers mailing list * http://www.swiftmq.com
To unsubscribe from this list, send an eMail to 
[EMAIL PROTECTED] and write in the body of your message:
UNSUBSCRIBE developers <your-email-address>
Archive: http://www.mail-archive.com/developers@mail.iit.de/




Reply via email to