本文整理了Java中org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsemble.getMembers()
方法的一些代码示例,展示了ZooKeeperEnsemble.getMembers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperEnsemble.getMembers()
方法的具体详情如下:
包路径:org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsemble
类名称:ZooKeeperEnsemble
方法名:getMembers
暂无
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging
public List<ZooKeeperServerConfig> getZookeeperServers() throws ExecutionException, InterruptedException {
List<ZooKeeperServerConfig> result = Lists.newArrayList();
if (entity.getParent() instanceof ZooKeeperEnsemble) {
ZooKeeperEnsemble ensemble = (ZooKeeperEnsemble) entity.getParent();
for (Entity member : ensemble.getMembers()) {
Integer memberId = member.config().get(ZooKeeperNode.MY_ID);
if (memberId == null) {
throw new IllegalStateException(member + " has null value for " + ZooKeeperNode.MY_ID);
}
String hostname = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.SUBNET_HOSTNAME).get();
Integer port = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.ZOOKEEPER_PORT).get();
Integer leaderPort = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.ZOOKEEPER_LEADER_PORT).get();
Integer electionPort = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.ZOOKEEPER_ELECTION_PORT).get();
result.add(new ZooKeeperServerConfig(memberId, hostname, port, leaderPort, electionPort));
}
}
return result;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging
"expected value for " + ZooKeeperEnsemble.ZOOKEEPER_ENDPOINTS + " on " + ensemble + ", was null");
Set<Integer> nodeIds = Sets.newHashSet();
for (Entity zkNode : ensemble.getMembers()) {
nodeIds.add(zkNode.config().get(ZooKeeperNode.MY_ID));
内容来源于网络,如有侵权,请联系作者删除!