Hi,
I have the following main function:
public static void main(String[] args) {
StateMachine<FSM, FSMState, FSMEvent, String> fsm = createFSM();
fsm.fire(FSMEvent.QUESTION, "Why sky is blue?");
fsm.fire(FSMEvent.TERMINATE);
}
I also define an onEntry function for terminate event:
builder.onEntry(FSMState.TERMINATE).perform(
new AnonymousAction<FSM, FSMState, FSMEvent, String>() {
@Override
public void execute(FSMState from, FSMState to, FSMEvent event,
String context, FSM stateMachine) {
if (stateMachine.getStatus() != StateMachineStatus.TERMINATED) {
stateMachine.terminate(null);
} else {
System.out.println("Not terminated.");
}
}
});
When I ran and debugged the main function, I came to the line:
stateMachine.terminate(null);
It seems the line of code had been successfully executed. However, the main function is still hanging there.
How can I stop the main function from hanging?
Thanks.