You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2017/07/20 11:48:33 UTC

kafka git commit: KAFKA-5134; Replace zkClient.getChildren method with zkUtils.getChildren

Repository: kafka
Updated Branches:
  refs/heads/trunk 0816e47bf -> 272956f03


KAFKA-5134; Replace zkClient.getChildren method with zkUtils.getChildren

Author: Balint Molnar <ba...@gmail.com>

Reviewers: Ismael Juma <is...@juma.me.uk>

Closes #3097 from baluchicken/KAFKA-5134-2


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

Branch: refs/heads/trunk
Commit: 272956f03a54ef4f476d6f6f49c0cf74e5daf7d0
Parents: 0816e47
Author: Balint Molnar <ba...@gmail.com>
Authored: Thu Jul 20 12:47:57 2017 +0100
Committer: Ismael Juma <is...@juma.me.uk>
Committed: Thu Jul 20 12:48:17 2017 +0100

----------------------------------------------------------------------
 .../kafka/common/ZkNodeChangeNotificationListener.scala     | 4 ++--
 .../scala/kafka/consumer/ZookeeperTopicEventWatcher.scala   | 2 +-
 .../kafka/consumer/ZookeeperConsumerConnectorTest.scala     | 9 ++-------
 3 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/272956f0/core/src/main/scala/kafka/common/ZkNodeChangeNotificationListener.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/common/ZkNodeChangeNotificationListener.scala b/core/src/main/scala/kafka/common/ZkNodeChangeNotificationListener.scala
index 960f690..37d35ff 100644
--- a/core/src/main/scala/kafka/common/ZkNodeChangeNotificationListener.scala
+++ b/core/src/main/scala/kafka/common/ZkNodeChangeNotificationListener.scala
@@ -77,8 +77,8 @@ class ZkNodeChangeNotificationListener(private val zkUtils: ZkUtils,
    * Process all changes
    */
   def processAllNotifications() {
-    val changes = zkUtils.zkClient.getChildren(seqNodeRoot)
-    processNotifications(changes.asScala.sorted)
+    val changes = zkUtils.getChildren(seqNodeRoot)
+    processNotifications(changes.sorted)
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/kafka/blob/272956f0/core/src/main/scala/kafka/consumer/ZookeeperTopicEventWatcher.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/consumer/ZookeeperTopicEventWatcher.scala b/core/src/main/scala/kafka/consumer/ZookeeperTopicEventWatcher.scala
index 1a86227..7de1980 100644
--- a/core/src/main/scala/kafka/consumer/ZookeeperTopicEventWatcher.scala
+++ b/core/src/main/scala/kafka/consumer/ZookeeperTopicEventWatcher.scala
@@ -65,7 +65,7 @@ class ZookeeperTopicEventWatcher(val zkUtils: ZkUtils,
       lock.synchronized {
         try {
           if (zkUtils != null) {
-            val latestTopics = zkUtils.zkClient.getChildren(ZkUtils.BrokerTopicsPath).asScala
+            val latestTopics = zkUtils.getChildren(ZkUtils.BrokerTopicsPath)
             debug("all topics: %s".format(latestTopics))
             eventHandler.handleTopicEvent(latestTopics)
           }

http://git-wip-us.apache.org/repos/asf/kafka/blob/272956f0/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala b/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
index bbf05e4..09b1e75 100644
--- a/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
+++ b/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
@@ -416,13 +416,8 @@ class ZookeeperConsumerConnectorTest extends KafkaServerTestHarness with Logging
   }
 
   def getZKChildrenValues(path : String) : Seq[Tuple2[String,String]] = {
-    val children = zkUtils.zkClient.getChildren(path)
-    Collections.sort(children)
-    val childrenAsSeq : Seq[java.lang.String] = {
-      import scala.collection.JavaConversions._
-      children.toSeq
-    }
-    childrenAsSeq.map(partition =>
+    val children = zkUtils.getChildren(path).sorted
+    children.map(partition =>
       (partition, zkUtils.zkClient.readData(path + "/" + partition).asInstanceOf[String]))
   }