Class QuorumMaj
java.lang.Object
org.apache.zookeeper.server.quorum.flexible.QuorumMaj
- All Implemented Interfaces:
QuorumVerifier
- Direct Known Subclasses:
QuorumOracleMaj
This class implements a validator for majority quorums. The implementation is
straightforward.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQuorumMaj
(Map<Long, QuorumPeer.QuorumServer> allMembers) Defines a majority to avoid computing it every time.QuorumMaj
(Properties props) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsQuorum
(Set<Long> ackSet) Verifies if a set is a majority.boolean
long
long
getWeight
(long id) Returns weight of 1 by default.int
hashCode()
void
setVersion
(long ver) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.zookeeper.server.quorum.flexible.QuorumVerifier
askOracle, getNeedOracle, getOraclePath, overrideQuorumDecision, revalidateOutstandingProp, revalidateVoteset, updateNeedOracle
-
Field Details
-
half
protected int half
-
-
Constructor Details
-
QuorumMaj
Defines a majority to avoid computing it every time. -
QuorumMaj
- Throws:
QuorumPeerConfig.ConfigException
-
-
Method Details
-
hashCode
public int hashCode() -
equals
- Specified by:
equals
in interfaceQuorumVerifier
- Overrides:
equals
in classObject
-
getWeight
public long getWeight(long id) Returns weight of 1 by default.- Specified by:
getWeight
in interfaceQuorumVerifier
- Parameters:
id
-
-
toString
- Specified by:
toString
in interfaceQuorumVerifier
- Overrides:
toString
in classObject
-
containsQuorum
Verifies if a set is a majority. Assumes that ackSet contains acks only from votingMembers- Specified by:
containsQuorum
in interfaceQuorumVerifier
-
getAllMembers
- Specified by:
getAllMembers
in interfaceQuorumVerifier
-
getVotingMembers
- Specified by:
getVotingMembers
in interfaceQuorumVerifier
-
getObservingMembers
- Specified by:
getObservingMembers
in interfaceQuorumVerifier
-
getVersion
public long getVersion()- Specified by:
getVersion
in interfaceQuorumVerifier
-
setVersion
public void setVersion(long ver) - Specified by:
setVersion
in interfaceQuorumVerifier
-