*
* @param zkClient
* @return
*/
public Cluster getCluster() {
final Cluster cluster = new Cluster();
final List<String> nodes = ZkUtils.getChildren(this.zkClient, this.brokerIdsPath);
for (final String node : nodes) {
// String brokerZKString = readData(zkClient, brokerIdsPath + "/" +
// node);
final int brokerId = Integer.parseInt(node);
final Set<Broker> brokers = this.getBrokersById(brokerId);
if (brokers != null && !brokers.isEmpty()) {
cluster.addBroker(brokerId, brokers);
}
}
return cluster;
}