You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/04/24 16:14:49 UTC
svn commit: r1471425 - in /camel/branches/camel-2.11.x: ./
components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
components/camel-http/ components/camel-jms/
Author: ningjiang
Date: Wed Apr 24 14:14:48 2013
New Revision: 1471425
URL: http://svn.apache.org/r1471425
Log:
CAMEL-6310 BlueprintCamelContext start() method should setup the TCCL
Merged revisions 1471407 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1471407 | ningjiang | 2013-04-24 21:33:25 +0800 (Wed, 24 Apr 2013) | 1 line
CAMEL-6310 BlueprintCamelContext start() method should setup the TCCL
........
Modified:
camel/branches/camel-2.11.x/ (props changed)
camel/branches/camel-2.11.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
camel/branches/camel-2.11.x/components/camel-http/ (props changed)
camel/branches/camel-2.11.x/components/camel-jms/ (props changed)
Propchange: camel/branches/camel-2.11.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1471407
Propchange: camel/branches/camel-2.11.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 24 14:14:48 2013
@@ -1 +1 @@
-/camel/trunk:1-1468763,1469704,1469819,1470420,1470426-1470427,1470429,1470508,1471293,1471330
+/camel/trunk:1-1468763,1469704,1469819,1470420,1470426-1470427,1470429,1470508,1471293,1471330,1471407
Modified: camel/branches/camel-2.11.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.11.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java?rev=1471425&r1=1471424&r2=1471425&view=diff
==============================================================================
--- camel/branches/camel-2.11.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java (original)
+++ camel/branches/camel-2.11.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java Wed Apr 24 14:14:48 2013
@@ -25,20 +25,24 @@ import org.apache.camel.core.osgi.utils.
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.FactoryFinder;
import org.apache.camel.spi.Registry;
+import org.apache.camel.util.ObjectHelper;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.container.BlueprintEvent;
import org.osgi.service.blueprint.container.BlueprintListener;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BlueprintCamelContext extends DefaultCamelContext implements ServiceListener, BlueprintListener {
private static final transient Logger LOG = LoggerFactory.getLogger(BlueprintCamelContext.class);
-
+
private BundleContext bundleContext;
private BlueprintContainer blueprintContainer;
private ServiceRegistration<?> registration;
@@ -75,7 +79,7 @@ public class BlueprintCamelContext exten
public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
this.blueprintContainer = blueprintContainer;
}
-
+
public void init() throws Exception {
LOG.trace("init {}", this);
@@ -148,23 +152,32 @@ public class BlueprintCamelContext exten
Registry reg = new BlueprintContainerRegistry(getBlueprintContainer());
return OsgiCamelContextHelper.wrapRegistry(this, reg, bundleContext);
}
+
+ @Override
+ public void start() throws Exception {
+ final ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ // let's set a more suitable TCCL while starting the context
+ Thread.currentThread().setContextClassLoader(getApplicationContextClassLoader());
+ super.start();
+ } finally {
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ }
private void maybeStart() throws Exception {
LOG.trace("maybeStart: {}", this);
-
+ // for example from unit testing we want to start Camel later and not
+ // when blueprint loading the bundle
if (!isStarted() && !isStarting()) {
- final ClassLoader original = Thread.currentThread().getContextClassLoader();
- try {
- // let's set a more suitable TCCL while starting the context
- Thread.currentThread().setContextClassLoader(getApplicationContextClassLoader());
- LOG.debug("Starting {}", this);
- start();
- } finally {
- Thread.currentThread().setContextClassLoader(original);
- }
+ LOG.debug("Starting {}", this);
+ start();
} else {
// ignore as Camel is already started
LOG.trace("Ignoring maybeStart() as {} is already started", this);
}
+
}
+
+
}
Propchange: camel/branches/camel-2.11.x/components/camel-http/
------------------------------------------------------------------------------
Merged /camel/trunk/components/camel-http:r1471407
Propchange: camel/branches/camel-2.11.x/components/camel-jms/
------------------------------------------------------------------------------
Merged /camel/trunk/components/camel-jms:r1471407