camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject camel git commit: CAMEL-10701 - Use proper classloader for loading authentication settings in Kafka
Date Fri, 13 Jan 2017 10:04:17 GMT
Repository: camel
Updated Branches:
  refs/heads/master 238287023 -> 83c3e86d5


CAMEL-10701 - Use proper classloader for loading authentication settings in Kafka


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

Branch: refs/heads/master
Commit: 83c3e86d5db7f6429fb5e7f262c8f23dd4ddaf25
Parents: 2382870
Author: Antoine DESSAIGNE <antoine.dessaigne@gmail.com>
Authored: Fri Jan 13 10:33:25 2017 +0100
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Fri Jan 13 11:03:56 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/kafka/KafkaConsumer.java     | 4 ++--
 .../java/org/apache/camel/component/kafka/KafkaProducer.java     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/83c3e86d/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
index 4362390..549c1c2 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
@@ -119,8 +119,8 @@ public class KafkaConsumer extends DefaultConsumer {
 
             ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
             try {
-                //Fix for running camel-kafka in OSGI see KAFKA-3218
-                Thread.currentThread().setContextClassLoader(null);
+                // Kafka uses reflection for loading authentication settings, use its classloader
+                Thread.currentThread().setContextClassLoader(org.apache.kafka.clients.consumer.KafkaConsumer.class.getClassLoader());
                 this.consumer = new org.apache.kafka.clients.consumer.KafkaConsumer(kafkaProps);
             } finally {
                 Thread.currentThread().setContextClassLoader(threadClassLoader);

http://git-wip-us.apache.org/repos/asf/camel/blob/83c3e86d/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 1a3ae93..2ffe96b 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
@@ -83,8 +83,8 @@ public class KafkaProducer extends DefaultAsyncProducer {
         if (kafkaProducer == null) {
             ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
             try {
-                //Fix for running camel-kafka in OSGI see KAFKA-3218
-                Thread.currentThread().setContextClassLoader(null);
+                // Kafka uses reflection for loading authentication settings, use its classloader
+                Thread.currentThread().setContextClassLoader(org.apache.kafka.clients.producer.KafkaProducer.class.getClassLoader());
                 kafkaProducer = new org.apache.kafka.clients.producer.KafkaProducer(props);
             } finally {
                 Thread.currentThread().setContextClassLoader(threadClassLoader);


Mime
View raw message