Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commons SCXML - Force jump to a given state

I am using Apache Commons SCXML, and I would like to know if it is possible to tell the state machine (SCXMLExecutor) to jump to a given state.

I can not use the initialstate attribute, because I want the state machine to recover (i.e. from power failures), and the only thing I have is the last state. That is why I was thinking about telling the state machine to make a direct jump to it.

like image 281
Guido Avatar asked Sep 18 '25 15:09

Guido


1 Answers

In the general case it's a really bad idea to jump to a state without the state machine's being "aware" of it, because there may be preconditions for a particular state's execution that aren't satisfied (that would be if you reached the state the "normal") way. A better idea is to design the state machine with a "restart" capability, implemented as an input "restart" event and the states and transitions necessary to handle it.

like image 116
Jim Garrison Avatar answered Sep 20 '25 06:09

Jim Garrison