Announcement Announcement Module
No announcement yet.
DefaultMessageListenerContainer setMaxConcurrentConsumers(n) = n+ 1 consumer threads Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultMessageListenerContainer setMaxConcurrentConsumers(n) = n+ 1 consumer threads

    I'm using Spring 3.0.5, I noticed while wiring up a ThreadPoolTaskExecutor as the task executor for a DefaultMessageListenerContainer that at runtime the number of consumer threads created by DMLC is actually +1 of the value set in call to setMaxConcurrentConsumers(), I only noticed it because I had set max size on ThreadPoolTaskExecutor to be same as max consumers on DMLC and the task executor had rejection policy as CALLER_RUNS with a queue size of 0, i just assumed those wouldn't matter anyways since the DMLC would never ask for more than n threads, but it turned out that the DMLC was creating one additional consumer thread and when it did..due to the CALLER_RUNS w/ zero queue capacity on the task executor, that caused a deadlock on all n threads, they all became blocked on DMLC call to isRunning(). I just wanted to mention this, there are many ways to avoid this with better choice of task executor config(or don't specify one and let the DMLC create it's own AsyncTaskExecutor), this was more a matter of my mis-config that led to some info i thought might be worthwhile to share.