Re: [SCXML] SimpleSCXMLInvoker may miss transition to final state

2007-07-06 Thread Rahul Akolkar

On 7/6/07, Ingmar Kliche <[EMAIL PROTECTED]> 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:

http://www.w3.org/2005/07/scxml version="1.0"
initialstate="state1">
 
  
   
  

  
 

 


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.

-Rahul

[1] http://jakarta.apache.org/commons/scxml/issue-tracking.html



- Ingmar.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SCXML] SimpleSCXMLInvoker may miss transition to final state

2007-07-06 Thread Ingmar Kliche

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:

http://www.w3.org/2005/07/scxml version="1.0"
initialstate="state1">

 
  
 

 





Therefore the invoke got stucked and the parent never received an
invoke.done event.

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)?

- Ingmar.