/** * This predicate checks that a leader has been elected. It doesn't * make a lot of sense without context (check lookForLeader) and it * has been separated for testing purposes. * * @param recv map of received votes * @param ooe map containing out of election votes (LEADING or FOLLOWING) * @param n Notification * @return */ protected boolean ooePredicate(HashMap<Long,Vote> recv, HashMap<Long,Vote> ooe, Notification n) { return (termPredicate(recv, new Vote(n.version, n.leader, n.zxid, n.electionEpoch, n.peerEpoch, n.state)) && checkLeader(ooe, n.leader, n.electionEpoch)); }
if (termPredicate(recvset, new Vote(proposedLeader, proposedZxid, logicalclock.get(), proposedEpoch))) {
return new Vote(proposedLeader, proposedZxid); } else if (termPredicate(recvset, new Vote(proposedLeader, proposedZxid, logicalclock))) { recvset.put(n.sid, new Vote(n.leader, n.zxid, n.epoch)); if((n.state == ServerState.LEADING) || (termPredicate(recvset, new Vote(n.leader, n.zxid, n.epoch, n.state)) && checkLeader(outofelection, n.leader, n.epoch)) ){ n.epoch, n.state)); if (termPredicate(outofelection, new Vote(n.leader, n.zxid, n.epoch, n.state)) && checkLeader(outofelection, n.leader, n.epoch)) {