Author: janstey
Date: Wed Oct 3 10:57:34 2012
New Revision: 1393404
URL: http://svn.apache.org/viewvc?rev=1393404&view=rev
Log:
Polish shutdown code
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=1393404&r1=1393403&r2=1393404&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
Wed Oct 3 10:57:34 2012
@@ -301,18 +301,16 @@ public class SedaConsumer extends Servic
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;
- }
+ shutdownExecutor();
}
@Override
protected void doShutdown() throws Exception {
- // only shutdown thread pool when we shutdown
- if (executor != null) {
+ shutdownExecutor();
+ }
+
+ private void shutdownExecutor() {
+ if (executor != null) {
endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
executor = null;
}