Overcome StackOverFlow without extenal trigger
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2015 08:52 PM
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;
This setup throws “already taking a transition” exeception.
Option 2: Add EventListener.
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).
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"> <extensionElements> <activiti:executionListener event="start" delegateExpression="${receiveTaskListener}"/> </extensionElements> </receiveTask>
@Component("receiveTaskListener")public class ReceiveTaskListener implements ExecutionListener { public void notify(DelegateExecution execution) throws Exception { Task task = execution.getEngineServices().getTaskService().createTaskQuery() .taskDefinitionKey("waitTask").singleResult(); execution.getEngineServices().getTaskService().complete(task.getId()); }}
This setup throws “already taking a transition” exeception.
Option 2: Add EventListener.
public class ProcessListener implements ActivitiEventListener { @Override public void onEvent(ActivitiEvent event) { switch (event.getType()) { case ACTIVITY_STARTED: ExecutionQuery q = event.getEngineServices().getRuntimeService().createExecutionQuery(); List<Execution> executions = q.processInstanceId(event.getProcessInstanceId()) .activityId("waitTask").list(); if (executions != null) { for (Execution execution : executions) { event.getEngineServices().getRuntimeService().signal(execution.getId()); } }
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).
Labels:
- Labels:
-
Archive
multi-task-loops_jpg.txt
37 KB
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2015 12:44 PM
Am I incorrect in trying to signal ReceiveTask within the workflow?.I fail to do so. Or Should it only be done externally.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2015 02:35 PM
You could try to make the service task asynchronous. If the service task is multi instance (with 60 possible loops) then it's best to use an multi instance embedded sub process with an asynchronous service task. You could also try to raise the max stack size (like described here http://stackoverflow.com/questions/3700459/how-to-increase-the-java-stack-size).
Best regards,
Best regards,
