You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gg...@apache.org on 2015/07/21 11:24:04 UTC
[06/13] camel git commit: [CAMEL-8984] Explicitly start
OsgiCamelContextPublisher, it didn't unregister OSGi service
[CAMEL-8984] Explicitly start OsgiCamelContextPublisher, it didn't unregister OSGi service
(cherry picked from commit 9aa1ab935a24f210a8592e08a34fc6cc5ed10eea)
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ec5a7aa6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ec5a7aa6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ec5a7aa6
Branch: refs/heads/camel-2.15.x
Commit: ec5a7aa661a84abede33ad6e62cb7767edfeea6a
Parents: 140b0f9
Author: Grzegorz Grzybek <gr...@gmail.com>
Authored: Mon Jul 20 10:22:21 2015 +0200
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Tue Jul 21 09:44:20 2015 +0200
----------------------------------------------------------------------
.../camel/blueprint/CamelContextFactoryBean.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ec5a7aa6/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
index b8500cd..63240bb 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -179,6 +179,8 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
private BundleContext bundleContext;
@XmlTransient
private boolean implicitId;
+ @XmlTransient
+ private OsgiCamelContextPublisher osgiCamelContextPublisher;
public Class<BlueprintCamelContext> getObjectType() {
return BlueprintCamelContext.class;
@@ -301,7 +303,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
ClassLoader cl = new BundleDelegatingClassLoader(bundleContext.getBundle());
LOG.debug("Set the application context classloader to: {}", cl);
getContext().setApplicationContextClassLoader(cl);
- getContext().getManagementStrategy().addEventNotifier(new OsgiCamelContextPublisher(bundleContext));
+ osgiCamelContextPublisher = new OsgiCamelContextPublisher(bundleContext);
+ osgiCamelContextPublisher.start();
+ getContext().getManagementStrategy().addEventNotifier(osgiCamelContextPublisher);
try {
getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
@@ -313,6 +317,14 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
setupRoutes();
}
+ @Override
+ public void destroy() throws Exception {
+ super.destroy();
+ if (osgiCamelContextPublisher != null) {
+ osgiCamelContextPublisher.shutdown();
+ }
+ }
+
public String getDependsOn() {
return dependsOn;
}