cancel
Showing results for 
Search instead for 
Did you mean: 

Why ParallelMultiInstanceBehavior.leave() take all OutgoingTransitions ?

johnfan
Champ in-the-making
Champ in-the-making
I'm using Activiti 5.21.0 as BPM engine.

Asked to keep everything simple, i removed gateways(I know it is not good). Now the workflow is simpler. like
[img]https://camo.githubusercontent.com/458b61e9114bec5ee84e33d827e8f6f031f60e2a/687474703a2f2f7777772e63...[/img]

I set conditionExpression for every sequenceFlow, looking forward only one of userTask 2&3 would be activated depend on the exclusive condition set on the flows. It works fine only when userTask1 is not ParallelMultiInstanceTask. But if i set userTask1 parallel, when complete userTask1, no condition is calculated. userTask2 and userTask3 are both activated.

After looked through codes, i found that ParallelMultiInstanceBehavior.leave() act differently against other Behaviors.

if (joinedExecutions.size() >= nrOfInstances || completionConditionSatisfied(execution)) {
 
  // Removing all active child executions (ie because completionCondition is true)
  List<ExecutionEntity> executionsToRemove = new ArrayList<ExecutionEntity>();
  for (ActivityExecution childExecution : executionEntity.getParent().getExecutions()) {
    if (childExecution.isActive()) {
      executionsToRemove.add((ExecutionEntity) childExecution);
    }
  }
  for (ExecutionEntity executionToRemove : executionsToRemove) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Execution {} still active, but multi-instance is completed. Removing this execution.", executionToRemove);
    }
    executionToRemove.inactivate();
    executionToRemove.deleteCascade("multi-instance completed");
  }
  executionEntity.takeAll(executionEntity.getActivity().getOutgoingTransitions(), joinedExecutions);
}


I wonder if there are some reason when leaving ParallelMultiInstance, every outgoing should be taken. Is it possible to filter OutgoingTransitions using conditions?

Greetings.
1 REPLY 1

bisgoon
Champ in-the-making
Champ in-the-making

I face the same problem like yours. yes, the takeall() won't evaluate any EL on the sequenceflow. Yesterday i update to activiti 6 and test it in a hurry. It seems fix this issue. Today I'll double check it.