org.apache.zookeeper.server.quorum
Class LeaderElection
java.lang.Object
org.apache.zookeeper.server.quorum.LeaderElection
- All Implemented Interfaces:
- Election
public class LeaderElection
- extends java.lang.Object
- implements Election
Method Summary |
protected LeaderElection.ElectionResult |
countVotes(java.util.HashMap<java.net.InetSocketAddress,Vote> votes,
java.util.HashSet<java.lang.Long> heardFrom)
|
Vote |
lookForLeader()
Invoked in QuorumPeer to find or elect a new leader. |
void |
shutdown()
There is nothing to shutdown in this implementation of
leader election, so we simply have an empty method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
epochGen
protected static java.util.Random epochGen
self
protected QuorumPeer self
LeaderElection
public LeaderElection(QuorumPeer self)
countVotes
protected LeaderElection.ElectionResult countVotes(java.util.HashMap<java.net.InetSocketAddress,Vote> votes,
java.util.HashSet<java.lang.Long> heardFrom)
shutdown
public void shutdown()
- There is nothing to shutdown in this implementation of
leader election, so we simply have an empty method.
- Specified by:
shutdown
in interface Election
lookForLeader
public Vote lookForLeader()
throws java.lang.InterruptedException
- Invoked in QuorumPeer to find or elect a new leader.
- Specified by:
lookForLeader
in interface Election
- Throws:
java.lang.InterruptedException
Copyright © 2010 The Apache Software Foundation