[Anthill-pro] Waiting for multiple child workflow to finish.

Frederic Jean frederic.jean at ubisoft.com
Wed Sep 24 10:38:34 CDT 2008


I have a workflow that start a bunch of child workflow.

 

And then on another step I wait for all those workflow to finish before
continuing.

I am aware of this issue :
https://bugs.urbancode.com/browse/AHPSCRIPTS-40 where there is a
listener that listen on a WorkflowEvent but the code is blocking and in
my case I want all the child workflow to run in parallel . 

 

I wrote this piece of code which does not work  ,
workflows[j].isComplete() always return false everytime I fetch them...
any reason ???

 

Thank you

 

Frederic Jean

 

******

import com.urbancode.anthill3.runtime.scripting.helpers.*;

import com.urbancode.anthill3.services.build.*;

import com.urbancode.anthill3.AnthillRuntimeException.*;

import com.urbancode.anthill3.domain.buildrequest.*;

import com.urbancode.anthill3.domain.buildlife.*;

import com.urbancode.anthill3.domain.workflow.*;

import com.urbancode.anthill3.domain.servergroup.*;

import com.urbancode.anthill3.domain.security.*;

import com.urbancode.anthill3.domain.persistent.*;

import com.urbancode.anthill3.domain.project.*;



private org.apache.log4j.Logger log =
org.apache.log4j.Logger.getLogger("ContextScript");



//get current buildlife

BuildLife    currentBuildLife = BuildLifeLookup.getCurrent();



//init flag

boolean bAllComplete = false;



//do as long as all the child workflow are not complete

while ( bAllComplete == false )

{

   bAllComplete = true;



   //get workflows

   WorkflowCase [] workflows =
WorkflowCaseFactory.getInstance().restoreArrayForBuildLife(currentBuildL
ife);



   for (int j=0;j< workflows.length;j++)

   {  

      //ignore workflow running the code

      if (  !
workflows[j].getName().equals(WorkflowLookup.getCurrent().getName()) )

      {

        //append complete

         bAllComplete = bAllComplete && workflows[j].isComplete();      

      }    

   }

   

   Thread.sleep(1000);

}

****

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20080924/1b868b25/attachment.htm


More information about the Anthill-pro mailing list