Package com.tangosol.net
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 Summary
Fields Modifier and Type Field Description protected static ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule
ALL_ALLOWED
A QuorumRule that permits all actions.protected static ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule
NONE_ALLOWED
A QuorumRule that rejects all actions.
-
Constructor Summary
Constructors Constructor Description QuorumRule(int nRuleMask, int nThreshold)
Construct a state with the specified threshold and numeric representation.QuorumRule(int nRuleMask, int nThreshold, float flThresholdPct)
Construct a state with the specified threshold and numeric representation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule that)
Compare this Rule to another one based on thethreshold
.protected boolean
contains(int nMask)
Return true if the current rule contains the specified action mask.protected int
getRuleMask()
Return the numeric representation of the actions allowed by this rule.protected int
getThreshold()
Return the size threshold for this rule.protected float
getThresholdFactor()
Return the percentage threshold for this rule.protected void
setRuleMask(int nRuleMask)
Set the numeric representation of the actions allowed by this rule.protected void
setThreshold(int nThreshold)
Set the size threshold for this rule.protected void
setThresholdFactor(float flThreshold)
Set the percentage threshold for this rule.String
toString()
protected ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule
union(ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule rule)
Return a quorum rule composed from this and the specified rule that reflects the "union" of the two rules.
-
-
-
Field Detail
-
NONE_ALLOWED
protected static final ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule NONE_ALLOWED
A QuorumRule that rejects all actions.
-
ALL_ALLOWED
protected static final ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule ALL_ALLOWED
A QuorumRule that permits all actions.
-
-
Constructor Detail
-
QuorumRule
public QuorumRule(int nRuleMask, int nThreshold)
Construct a state with the specified threshold and numeric representation.- Parameters:
nRuleMask
- numeric representation of the statenThreshold
- 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 statenThreshold
- the size threshold of the stateflThresholdPct
- the size of threshold of the state in percentage
-
-
Method Detail
-
compareTo
public int compareTo(ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule that)
Compare this Rule to another one based on thethreshold
.- Specified by:
compareTo
in interfaceComparable<ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule>
-
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
protected ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule union(ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule rule)
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
-
-