@Override public org.neo4j.cluster.InstanceId getElectionWinner(String role) { Election election = elections.get(role); if (election == null || election.getVotes().size() != getNeededVoteCount()) { return null; } elections.remove(role); return election.pickWinner(); }
@Override public int getVoteCount(String role) { Election election = elections.get(role); if (election != null) { Map<org.neo4j.cluster.InstanceId, Vote> voteList = election.getVotes(); if (voteList == null) { return 0; } return voteList.size(); } else { return 0; } }
@Override public void failed(URI server) { // Suggest reelection for all roles of this node election.demote(server); }