You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jonathan Anstey (JIRA)" <ji...@apache.org> on 2012/10/02 22:17:07 UTC

[jira] [Created] (CAMEL-5677) Stopping and starting a seda consumer leaks a thread each time

Jonathan Anstey created CAMEL-5677:
--------------------------------------

             Summary: Stopping and starting a seda consumer leaks a thread each time
                 Key: CAMEL-5677
                 URL: https://issues.apache.org/jira/browse/CAMEL-5677
             Project: Camel
          Issue Type: Bug
            Reporter: Jonathan Anstey
            Assignee: Jonathan Anstey


Just did something like this:

        for (int i = 0; i < 1000; i++) {
            context.stopRoute("sedaToMock");
            context.startRoute("sedaToMock");	        
        }      

and yeah, I had over 1000 threads in my JVM... not good :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CAMEL-5677) Stopping and starting a seda consumer leaks a thread each time

Posted by "Jonathan Anstey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Anstey resolved CAMEL-5677.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.10.2
                   2.11.0
                   2.9.4
    
> Stopping and starting a seda consumer leaks a thread each time
> --------------------------------------------------------------
>
>                 Key: CAMEL-5677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5677
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Jonathan Anstey
>            Assignee: Jonathan Anstey
>             Fix For: 2.9.4, 2.11.0, 2.10.2
>
>
> Just did something like this:
>         for (int i = 0; i < 1000; i++) {
>             context.stopRoute("sedaToMock");
>             context.startRoute("sedaToMock");	        
>         }      
> and yeah, I had over 1000 threads in my JVM... not good :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-5677) Stopping and starting a seda consumer leaks a thread each time

Posted by "Jonathan Anstey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Anstey updated CAMEL-5677:
-----------------------------------

    Fix Version/s: 2.8.7
    
> Stopping and starting a seda consumer leaks a thread each time
> --------------------------------------------------------------
>
>                 Key: CAMEL-5677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5677
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Jonathan Anstey
>            Assignee: Jonathan Anstey
>             Fix For: 2.8.7, 2.9.4, 2.11.0, 2.10.2
>
>
> Just did something like this:
>         for (int i = 0; i < 1000; i++) {
>             context.stopRoute("sedaToMock");
>             context.startRoute("sedaToMock");	        
>         }      
> and yeah, I had over 1000 threads in my JVM... not good :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CAMEL-5677) Stopping and starting a seda consumer leaks a thread each time

Posted by "Jonathan Anstey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13468036#comment-13468036 ] 

Jonathan Anstey commented on CAMEL-5677:
----------------------------------------

Running tests on this solution now:

{code}
[janstey@duffman camel-core (trunk)]$ git diff
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
index a21ab36..cbe23ac 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
@@ -300,6 +300,13 @@ public class SedaConsumer extends ServiceSupport implements Consumer, Runnable,
 
     protected void doStop() throws Exception {
         endpoint.onStopped(this);
+        
+        // need to shutdown executor here as well or each time this endpoint is 
+        // started a new thread will be created
+        if (executor != null) {
+            endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
+            executor = null;
+        }
     }
 
     @Override
{code}
                
> Stopping and starting a seda consumer leaks a thread each time
> --------------------------------------------------------------
>
>                 Key: CAMEL-5677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5677
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Jonathan Anstey
>            Assignee: Jonathan Anstey
>
> Just did something like this:
>         for (int i = 0; i < 1000; i++) {
>             context.stopRoute("sedaToMock");
>             context.startRoute("sedaToMock");	        
>         }      
> and yeah, I had over 1000 threads in my JVM... not good :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira