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

Author: Balint Molnar <balintmolnar91@gmail.com>

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

Closes #3097 from baluchicken/KAFKA-5134-2
This commit is contained in:
Balint Molnar 2017-07-20 12:47:57 +01:00 committed by Ismael Juma
parent 0816e47bfe
commit 272956f03a
3 changed files with 5 additions and 10 deletions

View File

@ -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)
}
/**

View File

@ -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)
}

View File

@ -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]))
}