use of org.apache.curator.framework.recipes.leader.Participant in project storm by apache.
the class LeaderElectorImp method getAllNimbuses.
@Override
public List<NimbusInfo> getAllNimbuses() throws Exception {
List<NimbusInfo> nimbusInfos = new ArrayList<>();
Collection<Participant> participants = leaderLatch.get().getParticipants();
for (Participant participant : participants) {
nimbusInfos.add(Zookeeper.toNimbusInfo(participant));
}
return nimbusInfos;
}
use of org.apache.curator.framework.recipes.leader.Participant in project alluxio by Alluxio.
the class LeaderSelectorClient method getParticipants.
/**
* @return the list of participants
*/
public List<String> getParticipants() {
try {
List<Participant> participants = new ArrayList<>(mLeaderSelector.getParticipants());
List<String> results = new ArrayList<>();
for (Participant part : participants) {
results.add(part.getId());
}
return results;
} catch (Exception e) {
LOG.error(e.getMessage(), e);
return null;
}
}
use of org.apache.curator.framework.recipes.leader.Participant in project druid by druid-io.
the class DruidCoordinator method getCurrentLeader.
public String getCurrentLeader() {
try {
final LeaderLatch latch = leaderLatch.get();
if (latch == null) {
return null;
}
Participant participant = latch.getLeader();
if (participant.isLeader()) {
return participant.getId();
}
return null;
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
Aggregations