servicemix-beanflow - Workflow.joinAll failure to register onStop callback if 
first Activity stops during start handler
-----------------------------------------------------------------------------------------------------------------------

         Key: SM-439
         URL: https://issues.apache.org/activemq/browse/SM-439
     Project: ServiceMix
        Type: Bug

    Versions: incubation    
 Environment: osx, jdk 1.5
    Reporter: Jason Anderson


if the following code is run the JoinFlow.stop state will never be thrown 
because the internal JoinAll state is set to stopped after forking the first 
activity in the JoinSupport(Activity ...) constructor before the onStop 
callback is registered in WorkFlow.join

public class JoinTest extends TestCase {

    public static class JoinFlow extends Workflow<JoinFlow.Step> {

        public static enum Step {
            first, stop
        }

        public JoinFlow() {
            super(Step.first);
        }

        public void first() {
            final Activity a = new TimeoutActivity() {
                protected void onValidStateChange() {
                    System.out.println("in a");
                    stop();
                }
            };
            final Activity b = new TimeoutActivity() {
                protected void onValidStateChange() {
                    System.out.println("in b");
                    stop();
                }
            };
            System.out.println("in first");
            joinAll(Step.stop, 10000, a, b);
            System.out.println("after join");
        }
    }

    public void testJoin() throws Exception {
        JoinFlow flow = new JoinFlow();
        flow.start();
        flow.join();
    }


}


I believe if the JoinSupport were to add all the activities to the children 
list before forking them it would prevent the JoinAll.onChildStateChange from 
being called prematurely with childCount=1, stoppedCount=1 when there should be 
2 children but I cannot currently get the maven build to run to test this thoery





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to