commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <>
Subject Re: [SCXML] SimpleSCXMLInvoker may miss transition to final state
Date Fri, 06 Jul 2007 22:44:24 GMT
On 7/6/07, Ingmar Kliche <> wrote:
> The current implementation of SimpleSCXMLInvoker assumes that only external
> events, handled by parentEvents(), may cause the child state machine to
> go move a final state. I had a case where the invoked state machine went to
> a final state directly while executing the initial state, something like:
> <scxml xmlns= version="1.0"
> initialstate="state1">
>      <state id="state1">
>           <onentry>
>                <send event="foo"/>
>           </onentry>
>           <transition event="foo" target="state2" />
>      </state>
>      <state id="state2" final="true" />
> </scxml>
> Therefore the invoke got stucked and the parent never received an
> invoke.done event.

Yes, this looks like a problem. Again, please file tickets in JIRA [1]
-- if you can attach simple testcases that'd be very helpful.

> I see two problems:
> a) the parentEvents() method will not send a "invoke.done" event to the
> parent because "doneBefore" will already be true (for the above example).
> That means the parent gets never notified about the termination of the
> child.
> b) Even if we change the logic of parentEvents() in a way that a) will be
> solved, the problem is still that the termination of the state machine will
> only be detected once an external event occurs in the parent state machine
> and thus the parentEvents() method will be called.
> Is there a way to get notified in the environment of a state machine (like
> the invoke-Implementation) once a state machine reaches the final state?
> Until now I only found "polling" the current state like
> if (executor.getCurrentStatus().isFinal()) { ..}
> Don't we need a callback (implemented by an interface) to get notified about
> reaching a final state? The child state machine (invoked from a parent state
> machine) may communicate to another external process asynchronously and any
> event from this external process may cause the child state machine to go to
> a final state. How to notify the parent about termination of the invoke (i.e.
> sending an invoke.done)?

Correct, the canonical way is to poll. However, it is possible to
register a SCXMLListener and that gives us callbacks (at the least,
these tell us when to poll :-). The SimpleSCXMLInvoker is so called
because I think its possible to write a NotSoSimpleSCXMLInvoker that
does things like these better. Since Invoker registration is upto the
user, the idea was that the simple one would provide a skeleton to get
folks started.



> - Ingmar.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message