Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * See the file LICENSE for redistribution information.
  * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
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.
public enum QuorumPolicy {

All participants are required to vote.

A simple majority of participants is required to vote.

Returns the minimum number of nodes to needed meet the quorum policy.

groupSize the size of the replication group.
the number of nodes that are needed for a quorum for a group with groupSize number of nodes.
    public int quorumSize(int groupSize) {
        switch (this) {
            case :
                return groupSize;
            case :
                return (groupSize / 2 + 1);
                throw EnvironmentFailureException.unexpectedState
                    ("Unknown quorum:" + this);
New to GrepCode? Check out our FAQ X