Interface StateMachinePersister<S,E,T>

Type Parameters:
S - the type of state
E - the type of event
T - the type of context object
All Known Implementing Classes:
AbstractStateMachinePersister, DefaultStateMachinePersister, RedisStateMachinePersister

public interface StateMachinePersister<S,E,T>
Interface persisting and restoring a StateMachine from a persistent storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    persist(StateMachine<S,E> stateMachine, T contextObj)
    Persist a state machine with a given context object.
    restore(StateMachine<S,E> stateMachine, T contextObj)
    Reset a state machine with a given context object.
  • Method Details

    • persist

      void persist(StateMachine<S,E> stateMachine, T contextObj) throws Exception
      Persist a state machine with a given context object.
      Parameters:
      stateMachine - the state machine
      contextObj - the context ojb
      Throws:
      Exception - the exception in case or any persist error
    • restore

      StateMachine<S,E> restore(StateMachine<S,E> stateMachine, T contextObj) throws Exception
      Reset a state machine with a given context object. Returned machine has been reseted and is ready to be used.
      Parameters:
      stateMachine - the state machine
      contextObj - the context ojb
      Returns:
      the state machine
      Throws:
      Exception - the exception in case or any persist error