public class FastLeaderElection extends Object implements Election
Modifier and Type | Class and Description |
---|---|
static class |
FastLeaderElection.Notification
Notifications are messages that let other peers know that
a given peer has changed its vote, either because it has
joined leader election or because it learned of another
peer with higher zxid or same zxid and higher server id
|
static class |
FastLeaderElection.ToSend
Messages that a peer wants to send to other peers.
|
Constructor and Description |
---|
FastLeaderElection(QuorumPeer self,
QuorumCnxManager manager)
Constructor of FastLeaderElection.
|
Modifier and Type | Method and Description |
---|---|
QuorumCnxManager |
getCnxManager() |
long |
getLogicalClock()
Returns the current vlue of the logical clock counter
|
Vote |
lookForLeader()
Starts a new round of leader election.
|
void |
shutdown() |
protected boolean |
totalOrderPredicate(long newId,
long newZxid,
long newEpoch,
long curId,
long curZxid,
long curEpoch)
Check if a pair (server id, zxid) succeeds our
current vote.
|
public FastLeaderElection(QuorumPeer self, QuorumCnxManager manager)
self
- QuorumPeer that created this objectmanager
- Connection managerpublic long getLogicalClock()
public QuorumCnxManager getCnxManager()
protected boolean totalOrderPredicate(long newId, long newZxid, long newEpoch, long curId, long curZxid, long curEpoch)
id
- Server identifierzxid
- Last zxid observed by the issuer of this votepublic Vote lookForLeader() throws InterruptedException
lookForLeader
in interface Election
InterruptedException
Copyright © 2015 The Apache Software Foundation