kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsiva...@apache.org
Subject kafka git commit: KAFKA-5345; Close KafkaClient when streams client is closed
Date Fri, 02 Jun 2017 14:43:19 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.2 e944956a3 -> bac27673f


KAFKA-5345; Close KafkaClient when streams client is closed

Cherry-pick KAFKA-5345 to 0.10.2

Author: Rajini Sivaram <rajinisivaram@googlemail.com>

Reviewers: Guozhang Wang <wangguoz@gmail.com>, Ismael Juma <ismael@juma.me.uk>

Closes #3209 from rajinisivaram/KAFKA-5345-0102


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

Branch: refs/heads/0.10.2
Commit: bac27673fb47810bbae871c7f5973c7c0eadf516
Parents: e944956
Author: Rajini Sivaram <rajinisivaram@googlemail.com>
Authored: Fri Jun 2 15:42:41 2017 +0100
Committer: Rajini Sivaram <rajinisivaram@googlemail.com>
Committed: Fri Jun 2 15:42:41 2017 +0100

----------------------------------------------------------------------
 .../streams/processor/internals/StreamsKafkaClient.java      | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/bac27673/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsKafkaClient.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsKafkaClient.java
b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsKafkaClient.java
index bb75759..d8058b8 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsKafkaClient.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsKafkaClient.java
@@ -129,8 +129,12 @@ public class StreamsKafkaClient {
     }
 
     public void close() throws IOException {
-        for (MetricsReporter metricsReporter: this.reporters) {
-            metricsReporter.close();
+        try {
+            kafkaClient.close();
+        } finally {
+            for (MetricsReporter metricsReporter: this.reporters) {
+                metricsReporter.close();
+            }
         }
     }
 


Mime
View raw message