Results 1 to 2 of 2

Thread: Thread allocation on SimpleMessageListenerContainer restart

  1. #1
    Join Date
    Aug 2011
    Posts
    7

    Default Thread allocation on SimpleMessageListenerContainer restart

    I am just exposing some methods via jmx using which admin can do a
    1. start container
    2. stop container
    3. scale up/down consumers (concurrent consumers)

    I am able to do this, but while implementing this i just noticed one thing.

    When the container is running, on console i see:
    DEBUG SimpleAsyncTaskExecutor-1 [qp.rabbit.listener.BlockingQueueConsumer]: Retrieving delivery.......
    When i stop it and start it again, i now see:
    DEBUG SimpleAsyncTaskExecutor-2 [qp.rabbit.listener.BlockingQueueConsumer]: Retrieving delivery.......
    Now my question is what happend to SimpleAsyncTaskExecutor-1, when i restarted the container. Why did it create a new SimpleAsyncTaskexecutor-2?

    Does that mean on every restart, new executors are created ? If yes what happens to the old ones?
    Isn't this a possible memory leak?

    Please help

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,142

    Default

    No; it's not a leak; that's just the way the SimpleAsyncTaskExecutor names its threads. You get a new thread for each task; stopping the listener container terminates the original thread (...-1).

    See the javadoc here http://static.springsource.org/sprin...kExecutor.html

    If you want to reuse the original thread(s), use a thread-pooling TaskExecutor instead of the default SimpleAsyncTaskExecutor. You can inject your chosen TaskExecutor into the listener container.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •