org.apache.zookeeper.server.quorum.flexible
Class QuorumMaj

java.lang.Object
  extended by 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
QuorumMaj(int n)
          Defines a majority to avoid computing it every time.
 
Method Summary
 boolean containsQuorum(HashSet<Long> set)
          Verifies if a set is a majority.
 long getWeight(long id)
          Returns weight of 1 by default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuorumMaj

public QuorumMaj(int n)
Defines a majority to avoid computing it every time.

Parameters:
n - number of servers
Method Detail

getWeight

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

Specified by:
getWeight in interface QuorumVerifier
Parameters:
id -

containsQuorum

public boolean containsQuorum(HashSet<Long> set)
Verifies if a set is a majority.

Specified by:
containsQuorum in interface QuorumVerifier


Copyright © 2011 The Apache Software Foundation