You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2011/06/25 14:32:32 UTC

svn commit: r1139537 - /camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

Author: davsclaus
Date: Sat Jun 25 12:32:31 2011
New Revision: 1139537

URL: http://svn.apache.org/viewvc?rev=1139537&view=rev
Log:
CAMEL-4153: Keep thread pool alive when stopping seda consumer, as we should prefer to only shutdown/trash the pool when shutting down Camel.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=1139537&r1=1139536&r2=1139537&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java Sat Jun 25 12:32:31 2011
@@ -42,6 +42,9 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A Consumer for the SEDA component.
+ * <p/>
+ * In this implementation there is a little <i>slack period</i> when you suspend/stop the consumer, by which
+ * the consumer may pickup a newly arrived messages and process it. That period is up till 1 second.
  *
  * @version 
  */
@@ -234,15 +237,16 @@ public class SedaConsumer extends Servic
 
     @Override
     protected void doResume() throws Exception {
-        setupTasks();
-        endpoint.onStarted(this);
+        doStart();
     }
 
     protected void doStop() throws Exception {
         endpoint.onStopped(this);
-        // must shutdown executor on stop to avoid overhead of having them running
-        // use shutdown now to force the tasks which are polling for new exchanges
-        // to stop immediately to avoid them picking up new exchanges arriving in the mean time
+    }
+
+    @Override
+    protected void doShutdown() throws Exception {
+        // only shutdown thread pool when we shutdown
         if (executor != null) {
             endpoint.getCamelContext().getExecutorServiceStrategy().shutdownNow(executor);
             executor = null;