Berkeley DB Java Edition
version 5.0.34

com.sleepycat.je.rep
Enum QuorumPolicy

java.lang.Object
  extended by java.lang.Enum<QuorumPolicy>
      extended by com.sleepycat.je.rep.QuorumPolicy
All Implemented Interfaces:
Serializable, Comparable<QuorumPolicy>

public enum QuorumPolicy
extends Enum<QuorumPolicy>

The quorum policy determine the number of nodes that must participate to pick the winner of an election, and therefore the master of the group. The default quorum policy during the lifetime of the group is QuorumPolicy.SIMPLE_MAJORITY. The only time that the application needs to specify a specific quorum policy is at node startup time, by passing one to the ReplicatedEnvironment constructor.


Enum Constant Summary
ALL
          All participants are required to vote.
SIMPLE_MAJORITY
          A simple majority of participants is required to vote.
 
Method Summary
 int quorumSize(int groupSize)
          Returns the minimum number of nodes to needed meet the quorum policy.
static QuorumPolicy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static QuorumPolicy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ALL

public static final QuorumPolicy ALL
All participants are required to vote.


SIMPLE_MAJORITY

public static final QuorumPolicy SIMPLE_MAJORITY
A simple majority of participants is required to vote.

Method Detail

values

public static QuorumPolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (QuorumPolicy c : QuorumPolicy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static QuorumPolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

quorumSize

public int quorumSize(int groupSize)
Returns the minimum number of nodes to needed meet the quorum policy.

Parameters:
groupSize - the size of the replication group.
Returns:
the number of nodes that are needed for a quorum for a group with groupSize number of nodes.

Berkeley DB Java Edition
version 5.0.34

Copyright (c) 2004-2011 Oracle. All rights reserved.