My scxml is defined like this:
                       <state id="stateA">
                                <onentry>
                                        <log expr="'Inside stateA'"/>
                                </onentry>
                                <onexit>
                                        <log expr="'Leaving stateA'"/>
                                </onexit>
                                <transition event="gotoB" target="stateB"/>
                        </state>
                        <final id="stateB">
                                <onentry>
                                        <log expr="'Inside stateB'"/>
                                </onentry>
                                <onexit>
                                        <log expr="'Leaving stateB'"/>
                                </onexit>                               
                        </final>

So, I initiate an SCXMLExecutor object, set all the requisites and call go()
, like this:

SCXMLExecutor engine = new SCXMLExecutor(getEvaluator(), new
SimpleDispatcher(),
                                new SimpleErrorReporter());
                engine.setStateMachine(getSCXML());
                engine.setSuperStep(true);
                engine.setRootContext(getContext());
                engine.addListener(getSCXML(), getListener());
                try {
                        engine.go();
                } catch (ModelException me) {
                        me.printStackTrace();
                }

In the listener, I override the onEntry like this:

public void onEntry(TransitionTarget state) {
                System.out.println("Entering state " + state.getId());          
        }

After I call go() on my executor, I see the stateA being entered and then
the state machine stops as its waiting for the "gotoB" event to transition
to the next state.

Now, I serialize this executor object to a file.Wait for a few seconds, then
deserialize it and then call fireEvent("gotoB") which is defined as:

public void fireEvent(String eventName) {
                try {
                        executor.triggerEvent(new TriggerEvent(eventName,
                                        TriggerEvent.SIGNAL_EVENT));
                        System.out.println("fired 
eventsuccessfully:"+eventName);
                } catch (ModelException e) {
                        e.printStackTrace();
                }
        }

I see in the log that my event was fired on the executor, but I do not see
the stateB being entered. So obviously during serialization/deserialization
some entities were lost on the executor object. Any idea what I should be
looking for?


-- 
View this message in context: 
http://apache-commons.680414.n4.nabble.com/scxml-stop-and-resume-by-serializing-the-executor-does-not-work-tp2275888p2275888.html
Sent from the Commons - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to