}
public void run(){
try{
Vote v = null;
peer.setPeerState(ServerState.LOOKING);
LOG.info("Going to call leader election: " + i);
v = peer.getElectionAlg().lookForLeader();
if (v == null){
Assert.fail("Thread " + i + " got a null vote");
}
/*
* A real zookeeper would take care of setting the current vote. Here
* we do it manually.
*/
peer.setCurrentVote(v);
LOG.info("Finished election: " + i + ", " + v.getId());
} catch (Exception e) {
e.printStackTrace();
}
LOG.info("Joining");
}