Class ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule

java.lang.Object
com.tangosol.net.ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule
All Implemented Interfaces:
Comparable<ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule>
Enclosing class:
ConfigurableQuorumPolicy.MembershipQuorumPolicy

public static class ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule extends Object implements Comparable<ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule>
A quorum rule defines a set of allowable actions beyond the rule's threshold size.
  • Field Details

  • Constructor Details

    • QuorumRule

      public QuorumRule(int nRuleMask, int nThreshold)
      Construct a state with the specified threshold and numeric representation.
      Parameters:
      nRuleMask - numeric representation of the state
      nThreshold - the size threshold of the state
    • QuorumRule

      public QuorumRule(int nRuleMask, int nThreshold, float flThresholdPct)
      Construct a state with the specified threshold and numeric representation.
      Parameters:
      nRuleMask - numeric representation of the state
      nThreshold - the size threshold of the state
      flThresholdPct - the size of threshold of the state in percentage
  • Method Details

    • compareTo

      Compare this Rule to another one based on the threshold.
      Specified by:
      compareTo in interface Comparable<ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • contains

      protected boolean contains(int nMask)
      Return true if the current rule contains the specified action mask.
      Parameters:
      nMask - the action bitmask to test for
      Returns:
      true if the current rule contains the specified action mask
    • union

      Return a quorum rule composed from this and the specified rule that reflects the "union" of the two rules. The union of two rules A and B requires a membership threshold that is max(A.getThreshold(), A.getThreshold()) and allows all actions allowed by A or B.
      Parameters:
      rule - the rule to compute the union of this with
      Returns:
      a quorum rule representing the union with the specified rule
    • getRuleMask

      protected int getRuleMask()
      Return the numeric representation of the actions allowed by this rule.
      Returns:
      the numeric representation of this rule
    • setRuleMask

      protected void setRuleMask(int nRuleMask)
      Set the numeric representation of the actions allowed by this rule.
      Parameters:
      nRuleMask - the numeric representation of this rule
    • getThreshold

      protected int getThreshold()
      Return the size threshold for this rule.
      Returns:
      the size threshold for this rule
    • setThreshold

      protected void setThreshold(int nThreshold)
      Set the size threshold for this rule.
      Parameters:
      nThreshold - the size threshold for this rule
    • getThresholdFactor

      protected float getThresholdFactor()
      Return the percentage threshold for this rule.
      Returns:
      the percentage threshold for this rule
    • setThresholdFactor

      protected void setThresholdFactor(float flThreshold)
      Set the percentage threshold for this rule.
      Parameters:
      flThreshold - the percentage threshold for this rule