# Class QuorumMaj

java.lang.Object
org.apache.zookeeper.server.quorum.flexible.QuorumMaj

All Implemented Interfaces:
  `QuorumVerifier`

Direct Known Subclasses:
  `QuorumOracleMaj`

public class QuorumMaj extends Object implements QuorumVerifier
This class implements a validator for majority quorums. The implementation is straightforward.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected int`
`half`

## Constructor Summary

Constructors
Constructor
Description
`QuorumMaj(Map<Long, QuorumPeer.QuorumServer> allMembers)`
Defines a majority to avoid computing it every time.
`QuorumMaj(Properties props)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`containsQuorum(Set<Long> ackSet)`
Verifies if a set is a majority.
`boolean`
`equals(Object o)`
`Map<Long, QuorumPeer.QuorumServer>`
`getAllMembers()`
`Map<Long, QuorumPeer.QuorumServer>`
`getObservingMembers()`
`long`
`getVersion()`
`Map<Long, QuorumPeer.QuorumServer>`
`getVotingMembers()`
`long`
`getWeight(long id)`
Returns weight of 1 by default.
`int`
`hashCode()`
`void`
`setVersion(long ver)`
`String`
`toString()`

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface QuorumVerifier

`askOracle, getNeedOracle, getOraclePath, overrideQuorumDecision, revalidateOutstandingProp, revalidateVoteset, updateNeedOracle`

## Field Details

### half

protected int half

## Constructor Details

### QuorumMaj

public QuorumMaj(Map<Long, QuorumPeer.QuorumServer> allMembers)
Defines a majority to avoid computing it every time.

### QuorumMaj

public QuorumMaj(Properties props) throws QuorumPeerConfig.ConfigException

Throws:
  `QuorumPeerConfig.ConfigException`

## Method Details

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object o)

Specified by:
  `equals` in interface `QuorumVerifier`
Overrides:
  `equals` in class `Object`

### getWeight

public long getWeight(long id)
Returns weight of 1 by default.

Specified by:
  `getWeight` in interface `QuorumVerifier`
Parameters:
  `id` -

### toString

public String toString()

Specified by:
  `toString` in interface `QuorumVerifier`
Overrides:
  `toString` in class `Object`

### containsQuorum

public boolean containsQuorum(Set<Long> ackSet)
Verifies if a set is a majority. Assumes that ackSet contains acks only from votingMembers

Specified by:
  `containsQuorum` in interface `QuorumVerifier`

### getAllMembers

public Map<Long, QuorumPeer.QuorumServer> getAllMembers()

Specified by:
  `getAllMembers` in interface `QuorumVerifier`

### getVotingMembers

public Map<Long, QuorumPeer.QuorumServer> getVotingMembers()

Specified by:
  `getVotingMembers` in interface `QuorumVerifier`

### getObservingMembers

public Map<Long, QuorumPeer.QuorumServer> getObservingMembers()

Specified by:
  `getObservingMembers` in interface `QuorumVerifier`

### getVersion

public long getVersion()

Specified by:
  `getVersion` in interface `QuorumVerifier`

### setVersion

public void setVersion(long ver)

Specified by:
  `setVersion` in interface `QuorumVerifier`