camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: Fix for kafka partitioner static initializer in OSGI env
Date Fri, 01 Jul 2016 06:58:50 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x fc7fad5a7 -> ef0d58271


Fix for kafka partitioner static initializer in OSGI env


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/423f1384
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/423f1384
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/423f1384

Branch: refs/heads/camel-2.17.x
Commit: 423f138483a1022cce656965265cdfd79a868c3d
Parents: fc7fad5
Author: John Moon <john.moon@transamerica.com>
Authored: Wed Jun 29 14:44:55 2016 -0400
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jul 1 08:58:31 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/kafka/KafkaProducer.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/423f1384/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
index b1a496c..6170151 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
@@ -80,7 +80,13 @@ public class KafkaProducer extends DefaultAsyncProducer {
     protected void doStart() throws Exception {
         Properties props = getProps();
         if (kafkaProducer == null) {
-            kafkaProducer = new org.apache.kafka.clients.producer.KafkaProducer(props);
+            ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(null);
+                kafkaProducer = new org.apache.kafka.clients.producer.KafkaProducer(props);
+            } finally {
+                Thread.currentThread().setContextClassLoader(threadClassLoader);
+            }
         }
 
         // if we are in asynchronous mode we need a worker pool


Mime
View raw message