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 2012/09/28 11:24:31 UTC
svn commit: r1391374 - in /camel/branches/camel-2.10.x: ./
camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Author: davsclaus
Date: Fri Sep 28 09:24:30 2012
New Revision: 1391374
URL: http://svn.apache.org/viewvc?rev=1391374&view=rev
Log:
CAMEL-5561: ExecutorServiceManagement should shutdown after services
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1391373
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1391374&r1=1391373&r2=1391374&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Fri Sep 28 09:24:30 2012
@@ -889,7 +889,10 @@ public class DefaultCamelContext extends
}
public void addService(Object object) throws Exception {
+ doAddService(object, true);
+ }
+ private void doAddService(Object object, boolean closeOnShutdown) throws Exception {
// inject CamelContext
if (object instanceof CamelContextAware) {
CamelContextAware aware = (CamelContextAware) object;
@@ -917,7 +920,7 @@ public class DefaultCamelContext extends
// do not add endpoints as they have their own list
if (singleton && !(service instanceof Endpoint)) {
// only add to list of services to close if its not already there
- if (!hasService(service)) {
+ if (closeOnShutdown && !hasService(service)) {
servicesToClose.add(service);
}
}
@@ -1539,7 +1542,8 @@ public class DefaultCamelContext extends
// and we needed to create endpoints up-front as it may be accessed before this context is started
endpoints = new EndpointRegistry(this, endpoints);
addService(endpoints);
- addService(executorServiceManager);
+ // special for executorServiceManager as want to stop it manually
+ doAddService(executorServiceManager, false);
addService(producerServicePool);
addService(inflightRepository);
addService(shutdownStrategy);
@@ -1638,7 +1642,8 @@ public class DefaultCamelContext extends
shutdownServices(notifier);
}
- // shutdown management as the last one
+ // shutdown executor service and management as the last one
+ shutdownServices(executorServiceManager);
shutdownServices(managementStrategy);
shutdownServices(lifecycleStrategies);
// do not clear lifecycleStrategies as we can start Camel again and get the route back as before