camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1381943 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/seda/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/main/java/org/apache/camel/processor/a...
Date Fri, 07 Sep 2012 09:24:42 GMT
Author: davsclaus
Date: Fri Sep  7 09:24:41 2012
New Revision: 1381943

URL: http://svn.apache.org/viewvc?rev=1381943&view=rev
Log:
CAMEL-5563: Favor to shutdownNow in doShutdown as that is the forced shutdown when Camel shutdown
itself, and use regular shutdown/gracefulShutdown when stopping. This is for thread pools.
This keeps logic as previous releases.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
    camel/trunk/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConsumer.java
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java
    camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
    camel/trunk/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
    camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.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=1381943&r1=1381942&r2=1381943&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
Fri Sep  7 09:24:41 2012
@@ -306,7 +306,7 @@ public class SedaConsumer extends Servic
     protected void doShutdown() throws Exception {
         // only shutdown thread pool when we shutdown
         if (executor != null) {
-            endpoint.getCamelContext().getExecutorServiceManager().shutdown(executor);
+            endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
             executor = null;
         }
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
Fri Sep  7 09:24:41 2012
@@ -132,7 +132,7 @@ public class SedaEndpoint extends Defaul
         int size = getConsumers().size();
         if (size == 0 && multicastExecutor != null) {
             // stop the multicast executor as its not needed anymore when size is zero
-            getCamelContext().getExecutorServiceManager().shutdown(multicastExecutor);
+            getCamelContext().getExecutorServiceManager().shutdownGraceful(multicastExecutor);
             multicastExecutor = null;
         }
         if (size > 1) {
@@ -372,7 +372,7 @@ public class SedaEndpoint extends Defaul
         }
         // shutdown thread pool if it was in use
         if (multicastExecutor != null) {
-            getCamelContext().getExecutorServiceManager().shutdown(multicastExecutor);
+            getCamelContext().getExecutorServiceManager().shutdownNow(multicastExecutor);
             multicastExecutor = null;
         }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
Fri Sep  7 09:24:41 2012
@@ -360,7 +360,7 @@ public abstract class ScheduledPollConsu
     @Override
     protected void doShutdown() throws Exception {
         if (shutdownExecutor && scheduledExecutorService != null) {
-            getEndpoint().getCamelContext().getExecutorServiceManager().shutdown(scheduledExecutorService);
+            getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(scheduledExecutorService);
             scheduledExecutorService = null;
             future = null;
         }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java
Fri Sep  7 09:24:41 2012
@@ -232,7 +232,7 @@ public abstract class DelayProcessorSupp
     @Override
     protected void doShutdown() throws Exception {
         if (shutdownExecutorService && executorService != null) {
-            camelContext.getExecutorServiceManager().shutdown(executorService);
+            camelContext.getExecutorServiceManager().shutdownNow(executorService);
         }
         super.doShutdown();
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
Fri Sep  7 09:24:41 2012
@@ -965,7 +965,7 @@ public class MulticastProcessor extends 
         errorHandlers.clear();
 
         if (shutdownExecutorService && executorService != null) {
-            getCamelContext().getExecutorServiceManager().shutdown(executorService);
+            getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
         }
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
Fri Sep  7 09:24:41 2012
@@ -80,7 +80,7 @@ public class OnCompletionProcessor exten
     protected void doShutdown() throws Exception {
         ServiceHelper.stopAndShutdownService(processor);
         if (shutdownExecutorService) {
-            getCamelContext().getExecutorServiceManager().shutdown(executorService);
+            getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
         }
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
Fri Sep  7 09:24:41 2012
@@ -171,7 +171,7 @@ public class ThreadsProcessor extends Se
 
     protected void doShutdown() throws Exception {
         if (shutdownExecutorService) {
-            camelContext.getExecutorServiceManager().shutdown(executorService);
+            camelContext.getExecutorServiceManager().shutdownNow(executorService);
         }
         super.doShutdown();
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
Fri Sep  7 09:24:41 2012
@@ -217,7 +217,7 @@ public class WireTapProcessor extends Se
     protected void doShutdown() throws Exception {
         ServiceHelper.stopAndShutdownService(processor);
         if (shutdownExecutorService) {
-            destination.getCamelContext().getExecutorServiceManager().shutdown(executorService);
+            destination.getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
         }
     }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
Fri Sep  7 09:24:41 2012
@@ -970,10 +970,10 @@ public class AggregateProcessor extends 
         inProgressCompleteExchanges.clear();
 
         if (shutdownExecutorService) {
-            camelContext.getExecutorServiceManager().shutdown(executorService);
+            camelContext.getExecutorServiceManager().shutdownNow(executorService);
         }
         if (shutdownTimeoutCheckerExecutorService) {
-            camelContext.getExecutorServiceManager().shutdown(timeoutCheckerExecutorService);
+            camelContext.getExecutorServiceManager().shutdownNow(timeoutCheckerExecutorService);
             timeoutCheckerExecutorService = null;
         }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
Fri Sep  7 09:24:41 2012
@@ -149,7 +149,7 @@ public class TimerListenerManager extend
     protected void doShutdown() throws Exception {
         super.doShutdown();
         // shutdown thread pool when we are shutting down
-        camelContext.getExecutorServiceManager().shutdown(executorService);
+        camelContext.getExecutorServiceManager().shutdownNow(executorService);
         executorService = null;
         listeners.clear();
     }

Modified: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
(original)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
Fri Sep  7 09:24:41 2012
@@ -222,7 +222,7 @@ public class SqsConsumer extends Schedul
     protected void doShutdown() throws Exception {
         super.doShutdown();
         if (scheduledExecutor != null) {
-            getEndpoint().getCamelContext().getExecutorServiceManager().shutdown(scheduledExecutor);
+            getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(scheduledExecutor);
             scheduledExecutor = null;
         }
     }

Modified: camel/trunk/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConsumer.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConsumer.java
(original)
+++ camel/trunk/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConsumer.java
Fri Sep  7 09:24:41 2012
@@ -52,7 +52,7 @@ public class CouchDbConsumer extends Def
             task.stop();
         }
         if (executor != null) {
-            endpoint.getCamelContext().getExecutorServiceManager().shutdown(executor);
+            endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
             executor = null;
         }
     }

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
Fri Sep  7 09:24:41 2012
@@ -405,7 +405,7 @@ public class JmsComponent extends Defaul
     @Override
     protected void doShutdown() throws Exception {
         if (asyncStartStopExecutorService != null) {
-            getCamelContext().getExecutorServiceManager().shutdown(asyncStartStopExecutorService);
+            getCamelContext().getExecutorServiceManager().shutdownNow(asyncStartStopExecutorService);
             asyncStartStopExecutorService = null;
         }
         super.doShutdown();

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java
Fri Sep  7 09:24:41 2012
@@ -238,7 +238,7 @@ public abstract class ReplyManagerSuppor
 
         // must also stop executor service
         if (executorService != null) {
-            camelContext.getExecutorServiceManager().shutdown(executorService);
+            camelContext.getExecutorServiceManager().shutdownGraceful(executorService);
             executorService = null;
         }
     }

Modified: camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
(original)
+++ camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
Fri Sep  7 09:24:41 2012
@@ -110,7 +110,7 @@ public class MinaEndpoint extends Defaul
     protected void doShutdown() throws Exception {
         // shutdown thread pools
         for (ExecutorService executor : executors) {
-            getCamelContext().getExecutorServiceManager().shutdown(executor);
+            getCamelContext().getExecutorServiceManager().shutdownNow(executor);
         }
         executors.clear();
         super.doShutdown();

Modified: camel/trunk/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
(original)
+++ camel/trunk/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
Fri Sep  7 09:24:41 2012
@@ -85,7 +85,7 @@ public class StreamConsumer extends Defa
         // important: do not close the stream as it will close the standard
         // system.in etc.
         if (executor != null) {
-            endpoint.getCamelContext().getExecutorServiceManager().shutdown(executor);
+            endpoint.getCamelContext().getExecutorServiceManager().shutdownGraceful(executor);
             executor = null;
         }
         lines.clear();

Modified: camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java?rev=1381943&r1=1381942&r2=1381943&view=diff
==============================================================================
--- camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
(original)
+++ camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
Fri Sep  7 09:24:41 2012
@@ -165,6 +165,13 @@ public class XmppConsumer extends Defaul
     @Override
     protected void doStop() throws Exception {
         super.doStop();
+
+        // stop scheduler first
+        if (scheduledExecutor != null) {
+            getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(scheduledExecutor);
+            scheduledExecutor = null;
+        }
+
         if (muc != null) {
             if (LOG.isInfoEnabled()) {
                 LOG.info("Leaving room: {}", muc.getRoom());
@@ -176,10 +183,6 @@ public class XmppConsumer extends Defaul
         if (connection != null && connection.isConnected()) {
             connection.disconnect();
         }
-        if (scheduledExecutor != null) {
-            getEndpoint().getCamelContext().getExecutorServiceManager().shutdown(scheduledExecutor);
-            scheduledExecutor = null;
-        }
     }
 
     public void chatCreated(Chat chat, boolean createdLocally) {



Mime
View raw message