本文整理了Java中com.taobao.metamorphosis.utils.ZkUtils.readDataMaybeNull()
方法的一些代码示例,展示了ZkUtils.readDataMaybeNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtils.readDataMaybeNull()
方法的具体详情如下:
包路径:com.taobao.metamorphosis.utils.ZkUtils
类名称:ZkUtils
方法名:readDataMaybeNull
暂无
代码示例来源:origin: killme2008/Metamorphosis
/**
* zkѯmaster broker,null
* */
public Broker getMasterBrokerById(final int brokerId) {
final String brokersString = ZkUtils.readDataMaybeNull(this.zkClient, this.brokerIdsPathOf(brokerId, -1));
if (StringUtils.isNotBlank(brokersString)) {
return new Broker(brokerId, brokersString);
}
return null;
}
代码示例来源:origin: killme2008/Metamorphosis
ZkUtils.readDataMaybeNull(this.zkClient, this.brokerIdsPath + "/" + brokerId + "/" + broker);
if (StringUtils.isNotBlank(brokerData)) {
ret.add(new Broker(brokerId, brokerData + "?slaveId=" + slaveId));
代码示例来源:origin: killme2008/Metamorphosis
List<Partition> partList = null;
final String dataString =
ZkUtils.readDataMaybeNull(this.zkClient, this.brokerTopicsPathOf(topic, false, brokerId, -1));
if (StringUtils.isBlank(dataString)) {
continue;
代码示例来源:origin: com.taobao.metamorphosis/metamorphosis-client
@Override
public TopicPartitionRegInfo load(final String topic, final String group, final Partition partition) {
final ZKGroupTopicDirs topicDirs = this.metaZookeeper.new ZKGroupTopicDirs(topic, group);
final String znode = topicDirs.consumerOffsetDir + "/" + partition.toString();
final String offsetString = ZkUtils.readDataMaybeNull(this.zkClient, znode);
if (offsetString == null) {
return null;
}
else {
// Ͽͻ
final int index = offsetString.lastIndexOf("-");
if (index > 0) {
// 1.4ʼ¿ͻ
final long msgId = Long.parseLong(offsetString.substring(0, index));
final long offset = Long.parseLong(offsetString.substring(index + 1));
return new TopicPartitionRegInfo(topic, partition, offset, msgId);
}
else {
// Ͽͻ
final long offset = Long.parseLong(offsetString);
return new TopicPartitionRegInfo(topic, partition, offset);
}
}
}
代码示例来源:origin: com.taobao.metamorphosis/metamorphosis-tools
public String getOffset(OffsetQueryDO queryDO) {
if (!this.check(queryDO)) {
return null;
}
String path =
this.consumerBasePath + queryDO.getGroup() + "/offsets/" + queryDO.getTopic() + "/"
+ queryDO.getPartition();
String rt = ZkUtils.readDataMaybeNull(this.zkClient, path);
return normalizeOffset(rt);
}
内容来源于网络,如有侵权,请联系作者删除!