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 2020/11/02 19:56:44 UTC

[camel-karaf] branch master updated: CAMEL-15760: camel-blueprint / osgi should not throw WARN when shutting down about NoSuchComponentException.

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-karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 7830c05  CAMEL-15760: camel-blueprint / osgi should not throw WARN when shutting down about NoSuchComponentException.
7830c05 is described below

commit 7830c057f440f547864222a2265f4fea3714e1a5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 2 20:56:31 2020 +0100

    CAMEL-15760: camel-blueprint / osgi should not throw WARN when shutting down about NoSuchComponentException.
---
 .../main/java/org/apache/camel/blueprint/BlueprintCamelContext.java   | 3 +++
 .../main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
index 2aa1fd5..6923319 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
@@ -60,6 +60,9 @@ public class BlueprintCamelContext extends DefaultCamelContext implements Servic
         this.bundleContext = bundleContext;
         this.blueprintContainer = blueprintContainer;
 
+        // remove the OnCamelContextLifecycleStrategy that camel-core adds by default which does not work well for OSGi
+        getLifecycleStrategies().removeIf(l -> l.getClass().getSimpleName().contains("OnCamelContextLifecycleStrategy"));
+
         // inject common osgi
         OsgiCamelContextHelper.osgiUpdate(this, bundleContext);
 
diff --git a/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java b/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
index 20f2e73..699ea2c 100644
--- a/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
+++ b/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
@@ -29,6 +29,10 @@ public class OsgiDefaultCamelContext extends DefaultCamelContext {
 
     public OsgiDefaultCamelContext(BundleContext bundleContext) {
         super(false);
+
+        // remove the OnCamelContextLifecycleStrategy that camel-core adds by default which does not work well for OSGi
+        getLifecycleStrategies().removeIf(l -> l.getClass().getSimpleName().contains("OnCamelContextLifecycleStrategy"));
+
         this.bundleContext = bundleContext;
 
         // inject common osgi