You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dancerjohn <wi...@gmail.com> on 2013/10/16 15:03:22 UTC

File consumer thread not stopping when Tomcat stopped

I have a question similar to
[camel-file-consumer-template-threads-remaining-alive][1]. I have a webapp
running in a Tomcat container with a Spring and Camel context. I am using
Camel version 2.10.4. In it I have I use the `File` component as a polling
consumer. It is set up as follows:

    from("/myDir"+
         "?delete=true"+
         "&startingDirectoryMustExist=true"+
         "&scheduledExecutorService=#mySpringManagedExecutorService")

This runs fine as expected but when I attempt to stop Tomcat I get the
following message:

    SEVERE: The web application [/myapp] appears to have started a thread
         named [MyExecuteService-0] but has failed to stop it. This is very
likely to
         create a memory leak.

After invoking the shutdown.sh script I invoke `ps -ef | grep tomcat` and
the process is still running. If my app is not loaded or if I do not load
this route in my app tomcat stops properly.


  [1]:
http://stackoverflow.com/questions/11207962/camel-file-consumer-template-threads-remaining-alive



--
View this message in context: http://camel.465427.n5.nabble.com/File-consumer-thread-not-stopping-when-Tomcat-stopped-tp5741668.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File consumer thread not stopping when Tomcat stopped

Posted by dancerjohn <wi...@gmail.com>.
Thank you. I added a destroy-method="shutdown" to the executor service and
that resolved the issue.



--
View this message in context: http://camel.465427.n5.nabble.com/File-consumer-thread-not-stopping-when-Tomcat-stopped-tp5741668p5741683.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File consumer thread not stopping when Tomcat stopped

Posted by Claus Ibsen <cl...@gmail.com>.
If you create your own thread pool, then you need to shutdown that
also yourself.

eg you tell Camel to use a custom thread pool with
#mySpringManagedExecutorService

If you create that thread pool yourself then you need to stop it also.

Though you can use Camel to create thread pool also as documented
using <threadPool> or <threadPoolProfile>
http://camel.apache.org/threading-model.html

On Wed, Oct 16, 2013 at 3:03 PM, dancerjohn <wi...@gmail.com> wrote:
> I have a question similar to
> [camel-file-consumer-template-threads-remaining-alive][1]. I have a webapp
> running in a Tomcat container with a Spring and Camel context. I am using
> Camel version 2.10.4. In it I have I use the `File` component as a polling
> consumer. It is set up as follows:
>
>     from("/myDir"+
>          "?delete=true"+
>          "&startingDirectoryMustExist=true"+
>          "&scheduledExecutorService=#mySpringManagedExecutorService")
>
> This runs fine as expected but when I attempt to stop Tomcat I get the
> following message:
>
>     SEVERE: The web application [/myapp] appears to have started a thread
>          named [MyExecuteService-0] but has failed to stop it. This is very
> likely to
>          create a memory leak.
>
> After invoking the shutdown.sh script I invoke `ps -ef | grep tomcat` and
> the process is still running. If my app is not loaded or if I do not load
> this route in my app tomcat stops properly.
>
>
>   [1]:
> http://stackoverflow.com/questions/11207962/camel-file-consumer-template-threads-remaining-alive
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-consumer-thread-not-stopping-when-Tomcat-stopped-tp5741668.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen