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/03 06:06:51 UTC

[camel-karaf] branch camel-karaf-3.4.x 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 camel-karaf-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git


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

commit ef087f5eecf54a762787acc1d013d7a483c85883
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 3778f1e..3409d94 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
@@ -62,6 +62,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 9f85f73..edc00f0 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
@@ -30,6 +30,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