This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 65f4843 camel3 - Stop type converter registry as late as possible during shutdown of CamelContext as it may be in use during the stopping procedure. 65f4843 is described below commit 65f484394334c4314948651aa5cfe2165de6d447 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun May 26 09:30:52 2019 +0200 camel3 - Stop type converter registry as late as possible during shutdown of CamelContext as it may be in use during the stopping procedure. --- .../apache/camel/impl/engine/AbstractCamelContext.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java index 6191b73..f9fa38d 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java @@ -1255,10 +1255,13 @@ public abstract class AbstractCamelContext extends ServiceSupport implements Ext } // do not add endpoints as they have their own list if (singleton && !(service instanceof Endpoint)) { - // only add to list of services to stop if its not already - // there + // only add to list of services to stop if its not already there if (stopOnShutdown && !hasService(service)) { - servicesToStop.add(service); + // special for type converter / type converter registry which is stopped manual later + boolean tc = service instanceof TypeConverter || service instanceof TypeConverterRegistry; + if (!tc) { + servicesToStop.add(service); + } } } ServiceHelper.startService(service); @@ -2574,12 +2577,11 @@ public abstract class AbstractCamelContext extends ServiceSupport implements Ext log.warn("Error occurred while stopping lifecycle strategies. This exception will be ignored.", e); } - // shutdown services as late as possible + // shutdown services as late as possible (except type converters as they may be needed during the remainder of the stopping) shutdownServices(servicesToStop); servicesToStop.clear(); - // must notify that we are stopped before stopping the management - // strategy + // must notify that we are stopped before stopping the management strategy EventHelper.notifyCamelContextStopped(this); // stop the notifier service @@ -2595,6 +2597,10 @@ public abstract class AbstractCamelContext extends ServiceSupport implements Ext // do not clear lifecycleStrategies as we can start Camel again and get // the route back as before + // shutdown type converter as late as possible + ServiceHelper.stopService(typeConverter); + ServiceHelper.stopService(typeConverterRegistry); + // stop the lazy created so they can be re-created on restart forceStopLazyInitialization();