src/main/java/org/sikuli/slides/api/actions/ParallelAction.java
public void execute(Context context) throws ActionExecutionException{
		int count = 0;
		for (Action action : getChildren()){
			if (!isBackground(action)){
				count += 1;			
			}
		}

		doneSignal = new CountDownLatch(count);

		List<Worker> workers = Lists.newArrayList();
		for (Action action : getChildren()){
			final Context workerContxt = new Context(context);

			if (!isBackground(action)){			
				Worker worker = new Worker(action, workerContxt);
				workers.add(worker);
				new Thread(worker).start();
			}else{
				Worker worker = new BackgroundWorker(action, workerContxt);
				new Thread(worker).start();
			}
		}
		try {
			doneSignal.await();
		} catch (InterruptedException e) {

		}
		stop();

		// if any of the worker did not succeed, 
		// rethrow the associated ActionExecutionException
		for (Worker worker : workers){
			if (!worker.success){
				throw worker.exception;
			}
		}
	}
public void execute(Context context) throws ActionExecutionException{
		int count = 0;
		for (Action action : getChildren()){
			if (!isBackground(action)){
				count += 1;			
			}
		}

		doneSignal = new CountDownLatch(count);

		List<Worker> workers = Lists.newArrayList();
		for (Action action : getChildren()){
			final Context workerContxt = new Context(context);

			if (!isBackground(action)){			
				Worker worker = new Worker(action, workerContxt);
				workers.add(worker);
				new Thread(worker).start();
			}else{
				Worker worker = new BackgroundWorker(action, workerContxt);
				new Thread(worker).start();
			}
		}
		try {
			doneSignal.await();
		} catch (InterruptedException e) {

		}
		stop();

		// if any of the worker did not succeed, 
		// rethrow the associated ActionExecutionException
		for (Worker worker : workers){
			if (!worker.success){
				throw worker.exception;
			}
		}
	}
public void execute ( Context context ) throws ActionExecutionException { int count = 0 ; for ( Action action : getChildren ( ) ) { if ( ! isBackground ( action ) ) { count += 1 ; } } doneSignal = new CountDownLatch ( count ) ; List < Worker > workers = Lists . newArrayList ( ) ; for ( Action action : getChildren ( ) ) { final Context workerContxt = new Context ( context ) ; if ( ! isBackground ( action ) ) { Worker worker = new Worker ( action , workerContxt ) ; workers . add ( worker ) ; new Thread ( worker ) . start ( ) ; } else { Worker worker = new BackgroundWorker ( action , workerContxt ) ; new Thread ( worker ) . start ( ) ; } } try { doneSignal . await ( ) ; } catch ( InterruptedException e ) { } stop ( ) ; // if any of the worker did not succeed,  // rethrow the associated ActionExecutionException for ( Worker worker : workers ) { if ( ! worker . success ) { throw worker . exception ; } } }
Execute and wait for execution to finish
Execute and wait for execution to finish