commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Schwager" <>
Subject [SCXML] scxml-listener will not process in a defined order (problem: SCXMLExecutor.addListener based on Set)
Date Fri, 11 Jul 2008 16:25:35 GMT
Hi Rahul,

i'm running in a problem: i add two listeners to my SCXMLExecutor instance
	- the first one should run some business-methods using reflection (like you do in your watchclock-example)
	- the second one should check the current state and maybe trigger some other fsm's 

The order of execution of the listeners is important, because 
 - FIRST I want to process the business-methods  and
 - SECOND I want to inform other compontents of reaching+processing of business-methods is

Your implementation of remember the listeners based on java.util.Set - the order in a 
Set is not defined (because it's not an ordered element) - so, regardless of the sequence
Of adding my two listeners, your code executes the listeners in the wrong order (-:

Did I miss something or is this a feature request ?


   public void addListener(final SCXML scxml, final SCXMLListener listener) {
        Object observable = scxml;
        scInstance.getNotificationRegistry().addListener(observable, listener);

   private synchronized void fireOnEntry(final Object source,
            final TransitionTarget state) {

// ***** SET !!! not a Vector ..
        Set entries = (Set) regs.get(source);							
// ***** SET !!! not a Vector ..

        if (entries != null) {
            for (Iterator iter = entries.iterator(); iter.hasNext();) {
                SCXMLListener lst = (SCXMLListener);

Viele Gruesse

Daniel Schwager

DT Netsolution GmbH   -   Taläckerstr. 30    -    D-70437 Stuttgart
Geschäftsführer: Daniel Schwager, Stefan Hörz - HRB Stuttgart 19870
Tel: +49-711-849910-32, Fax: -932 -

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

View raw message