File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Spring JMS - DefaultMessageListenerContainer and taskExecuter Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "Spring JMS - DefaultMessageListenerContainer and taskExecuter " Watch "Spring JMS - DefaultMessageListenerContainer and taskExecuter " New topic
Author

Spring JMS - DefaultMessageListenerContainer and taskExecuter

tovi sofer
Greenhorn

Joined: Jun 15, 2008
Posts: 9
Hi,

I created standalone Spring application to consume messages from JMS queue. For that I used DefaultMessageListenerContainer. In order for the container to use thread-pool for the created invokers (and not create a new thread each time) I defined taskExecuter to be ThreadPoolTaskExecuter (for JAVA 5). This work OK, except from number of active consumers: I defined concurrentConsumers to be 5 (max is 10), but when I look at jconsole I see activeConsumers=1. (concurrentConsumers is shown as 5).
I didn't change any of ThreadPoolTaskExecuter default definitions - meaning corePoolSize is 1, etc.
When I remove taskExecuter attribute from DefaultMessageListenerContainer definition (and therefore SimpleTaskExecuter is used) I see in jconsole 5 active consumers as expected.

Also I saw in DefaultMessageListenerContainer.setTaskExceuter the following javadoc which I didn't understand:

Specify an alternative TaskExecutor for integration with an existing
thread pool. Note that this really only adds value if the threads are
managed in a specific fashion, for example within a J2EE environment.
A plain thread pool does not add much value, as this listener container
will occupy a number of threads for its entire lifetime.

Is that true? is using ThreadPoolTaskExceuter really gives me no benefit? what about reusing threads?

Thanks in advance.
 
 
subject: Spring JMS - DefaultMessageListenerContainer and taskExecuter
 
Threads others viewed
I/O exception (java.net.SocketException) caught when processing request
DefaultMessageListenerContainer not getting started
Threads: deadlock or not?
Need to understand about threading issues?
Threads/servlets/long task
MyEclipse, The Clear Choice