SHARE
TWEET

Untitled

a guest Oct 21st, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class MyService {
  2.  
  3.     @Autowired
  4.     StateMachineFactory<States, Events> factory;
  5.  
  6.     HashMap<String, StateMachine<States, Events>> stateMachineMap = new HashMap<>();
  7.  
  8.     void initMachine(String lessonId) {
  9.         StateMachine<States,Events> stateMachine = factory.getStateMachine();
  10.         stateMachine.start();
  11.         stateMachineMap.put(lessonId, stateMachine);
  12.     }
  13.  
  14.     void transit(Event e1, String lessonId){
  15.         stateMachineMap.get(lessonId).sendEvent(e1);
  16.     }
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top