commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barnett, James" <James.Barn...@aspect.com>
Subject [scxml] processing multiple events
Date Fri, 18 Nov 2005 15:58:37 GMT
I'm puzzled by the behavior of the scxml engine when I enter multiple events (separated by
spaces) at one time.  For example, when running the Standalone version with test script transitions-01.xml,
and in state 'ten', I would expect to be able to enter events 'ten.done twenty_one.done twenty_two.done'
and have the machine process all of them and go to state 'thirty'.  However, the system only
takes the first transition, to state twenty/twenty_one.  

Looking at the code, I think that there is a  problem in triggerEvents in SCXMLExecutor.java.
 The method consists of a do loop, with each iteration through the loop processing a single
event.  However at the bottom of the loop, we have:  

            if (superStep) {
               evs.clear();
            }
        } while(superStep && currentStatus.getEvents().size() > 0);

so if 'superStep' is true, the event list is cleared (via 'evs.clear').  However, if 'superStep'
is false, the 'while' condition will cause the loop to exit after the first iteration.  So
multiple events will never get processed.  I find that if I comment out both conditions mentioning
superStep, the multiple events do get processed and the system transitions to state 'thirty'.
 

These complications may arise from the semantics of superStep and its interaction with the
Standalone environment.  The simplest change would be to change the upper condition to 'if
(! superStep)...', but I would think that in that case the events should not be thrown away,
but rather left in the queue for further processing.  

Or am I completely off base?

- Jim
P.S. I have been able to compile the code, thanks to the previous pointers to the commons-build
area.  Many thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message