Class Utils

java.lang.Object
org.jgroups.raft.util.Utils

public class Utils extends Object
Since:
1.0.6
Author:
Bela Ban
  • 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 old View, it can be null.
      curr - The recent View.
      Returns:
      true if the coordinator changed, false, otherwise.
    • deleteLog

      @Deprecated(since="1.0.13", forRemoval=true) public static void deleteLog(RAFT r) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use RaftTestUtils.deleteRaftLog(RAFT) instead.
      Deletes the log data for the given RAFT instance.

      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

      public static boolean isRaftMember(String raftId, Collection<String> raftMembers)
      Verifies if the given raft ID belongs to the list of members.
      Parameters:
      raftId - The member to verify.
      raftMembers - The list of members.
      Returns:
      true if the member is a Raft member, false, otherwise.
    • extractRaftId

      public static String extractRaftId(org.jgroups.Address address)