AnsweredAssumed Answered

Overcome StackOverFlow without extenal trigger

Question asked by gul on Jun 19, 2015
Latest reply on Jun 21, 2015 by trademak
I am trying to convert 11 complex workflows from JBPM to Activiti.  They all contain serviceTasks only; and they all have one more multi-task loops. As shown in attached image.  Cardinality of such loops could reach 60. So; I am facing StackOverFlow Errors.
I introduced a RecieveTask. My aim with RecieveTask; is to save ”callStack” into DB and continue the loops, until it exits based on exclusive-gate condition.

Option 1: Add executionListener;

<receiveTask id="waitTask" name="Dummy Wait State to force db commit">
               <activiti:executionListener event="start" delegateExpression="${receiveTaskListener}"/>

public class ReceiveTaskListener implements ExecutionListener {   
   public void notify(DelegateExecution execution) throws Exception {      
      Task task = execution.getEngineServices().getTaskService().createTaskQuery()


This setup throws “already taking a transition” exeception.

Option 2: Add EventListener.

public class ProcessListener implements ActivitiEventListener {   
   public void onEvent(ActivitiEvent event) {
      switch (event.getType()) {
         ExecutionQuery q = event.getEngineServices().getRuntimeService().createExecutionQuery();
         List<Execution> executions = q.processInstanceId(event.getProcessInstanceId())
         if (executions != null) {            
            for (Execution execution : executions) {

This signal stops the entire execution.  Can someone please suggest, on how to continue the loops without StackOverFlow error.  Note: I cannot have external triggers(like JMS or Thread waits).