java.lang.Object
org.jgroups.raft.util.Utils
- Since:
- 1.0.6
- Author:
- Bela Ban
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Utils.MajoritycomputeMajority(org.jgroups.View old, org.jgroups.View new_view, int majority, org.jgroups.Address leader) static Utils.MajoritycomputeMajority(org.jgroups.View oldView, org.jgroups.View newView, RAFT raft) static voidDeprecated, for removal: This API element is subject to removal in a future version.static StringextractRaftId(org.jgroups.Address address) static booleanisMajorityLost(Collection<String> oldMembers, Collection<String> newMembers, int majority) static booleanisMajorityReached(Collection<String> oldMembers, Collection<String> newMembers, int majority) static booleanisRaftMember(String raftId, Collection<String> raftMembers) Verifies if the given raft ID belongs to the list of members.static booleanmajorityLost(org.jgroups.View old, org.jgroups.View new_view, int majority) static booleanmajorityReached(org.jgroups.View old, org.jgroups.View new_view, int majority) static booleanviewCoordinatorChanged(org.jgroups.View prev, org.jgroups.View curr) Verify if the coordinator change between two views.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
majorityReached
public static boolean majorityReached(org.jgroups.View old, org.jgroups.View new_view, int majority) -
majorityLost
public static boolean majorityLost(org.jgroups.View old, org.jgroups.View new_view, int majority) -
computeMajority
public static Utils.Majority computeMajority(org.jgroups.View old, org.jgroups.View new_view, int majority, org.jgroups.Address leader) -
isMajorityReached
public static boolean isMajorityReached(Collection<String> oldMembers, Collection<String> newMembers, int majority) -
isMajorityLost
public static boolean isMajorityLost(Collection<String> oldMembers, Collection<String> newMembers, int majority) -
computeMajority
public static Utils.Majority computeMajority(org.jgroups.View oldView, org.jgroups.View newView, RAFT raft) -
viewCoordinatorChanged
public static boolean viewCoordinatorChanged(org.jgroups.View prev, org.jgroups.View curr) Verify if the coordinator change between two views.- Parameters:
prev- The oldView, it can benull.curr- The recentView.- Returns:
trueif the coordinator changed,false, otherwise.
-
deleteLog
Deprecated, for removal: This API element is subject to removal in a future version.UseRaftTestUtils.deleteRaftLog(RAFT)instead.Deletes the log data for the givenRAFTinstance.Warning: This should be used in tests only.
- Parameters:
r- RAFT instance to delete the log contents.- Throws:
Exception- If an exception happens while deleting the log.
-
isRaftMember
Verifies if the given raft ID belongs to the list of members.- Parameters:
raftId- The member to verify.raftMembers- The list of members.- Returns:
trueif the member is a Raft member,false, otherwise.
-
extractRaftId
-
RaftTestUtils.deleteRaftLog(RAFT)instead.