本文整理了Java中com.taobao.metamorphosis.utils.ZkUtils.getChildren()
方法的一些代码示例,展示了ZkUtils.getChildren()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtils.getChildren()
方法的具体详情如下:
包路径:com.taobao.metamorphosis.utils.ZkUtils
类名称:ZkUtils
方法名:getChildren
暂无
代码示例来源:origin: killme2008/Metamorphosis
/**
* һbrokertopics
*
* */
public Set<String> getTopicsByBrokerIdFromMaster(final int brokerId) {
final Set<String> set = new HashSet<String>();
final List<String> allTopics = ZkUtils.getChildren(this.zkClient, this.brokerTopicsSubPath);
for (final String topic : allTopics) {
final List<String> brokers = ZkUtils.getChildren(this.zkClient, this.brokerTopicsSubPath + "/" + topic);
if (brokers != null && brokers.size() > 0) {
for (final String broker : brokers) {
if ((String.valueOf(brokerId) + "-m").equals(broker)) {
set.add(topic);
}
}
}
}
return set;
}
代码示例来源:origin: killme2008/Metamorphosis
/**
* طָtopicmaster brokers
* */
public Map<Integer, String> getMasterBrokersByTopic(final String topic) {
final Map<Integer, String> ret = new TreeMap<Integer, String>();
final List<String> brokerIds = ZkUtils.getChildren(this.zkClient, this.brokerTopicsPubPath + "/" + topic);
if (brokerIds == null) {
return ret;
}
for (final String brokerIdStr : brokerIds) {
if (!brokerIdStr.endsWith("-m")) {
continue;
}
final int brokerId = Integer.parseInt(StringUtils.split(brokerIdStr, "-")[0]);
final Broker broker = this.getMasterBrokerById(brokerId);
if (broker != null) {
ret.put(brokerId, broker.getZKString());
}
}
return ret;
}
代码示例来源:origin: killme2008/Metamorphosis
final List<String> brokers = ZkUtils.getChildren(this.zkClient, this.brokerIdsPath + "/" + brokerId);
if (brokers == null) {
return ret;
代码示例来源:origin: killme2008/Metamorphosis
for (final String topic : topics) {
List<String> partList = null;
final List<String> brokers = ZkUtils.getChildren(this.zkClient, this.brokerTopicsSubPath + "/" + topic);
for (final String broker : brokers) {
final String[] tmp = StringUtils.split(broker, "-");
代码示例来源:origin: killme2008/Metamorphosis
/**
* brokerȺ,slavemaster
*
* @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;
}
代码示例来源:origin: killme2008/Metamorphosis
for (final String topic : topics) {
List<Partition> partList = null;
final List<String> brokers = ZkUtils.getChildren(this.zkClient, this.brokerTopicsPubPath + "/" + topic);
for (final String broker : brokers) {
final String[] brokerStrs = StringUtils.split(broker, "-");
代码示例来源:origin: com.taobao.metamorphosis/metamorphosis-client
ZkUtils.getChildren(ConsumerZooKeeper.this.zkClient, this.dirs.consumerRegistryDir);
if (consumers == null) {
return Collections.emptyMap();
内容来源于网络,如有侵权,请联系作者删除!