QuorumMaj (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server.quorum.flexible

## Class QuorumMaj

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

- All Implemented Interfaces:
    QuorumVerifier

      public class QuorumMaj
      extends Object
      implements QuorumVerifier

  This class implements a validator for majority quorums. The implementation is straightforward.

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 java.lang.Object

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

- - ### Constructor Detail

    - #### 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 Detail

    - #### 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`

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.