Class StatusMachine


  • public final class StatusMachine
    extends Object
    This class contains static methods to implement the DS status state machine. They are used to validate the transitions of the state machine according to the current status and event, and to compute the new status. - Status (states of the state machine) are defined in ServerStatus enum - Events are defined in StateMachineEvent enum
    • Method Detail

      • isValidInitialStatus

        public static boolean isValidInitialStatus​(ServerStatus initStatus)
        Checks if a given status is valid as an entering status for the state machine.
        Parameters:
        initStatus - Initial status to check.
        Returns:
        True if the passed status is a valid initial status.
      • isTransitionAllowed

        public static boolean isTransitionAllowed​(ServerStatus fromStatus,
                                                  ServerStatus toStatus)
        Returns whether transition from fromStatus to toStatus is valid.
        Parameters:
        fromStatus - The current status we start from.
        toStatus - The status we are trying to go to.
        Returns:
        true if transition from fromStatus to toStatus is valid, false otherwise