use of org.apache.zookeeper.server.quorum.Vote in project zookeeper by apache.
the class AuthFastLeaderElection method termPredicate.
private boolean termPredicate(HashMap<InetSocketAddress, Vote> votes, long l, long zxid) {
Collection<Vote> votesCast = votes.values();
int count = 0;
/*
* First make the views consistent. Sometimes peers will have different
* zxids for a server depending on timing.
*/
for (Vote v : votesCast) {
if ((v.getId() == l) && (v.getZxid() == zxid))
count++;
}
if (count > (self.getVotingView().size() / 2))
return true;
else
return false;
}
Aggregations