I have a service task which inherits from AbstractBpmnActivityBehavior and calls leave() at the end of execute().
When calling this service task by delegate expression with multi instance then it results in an infinite loop when using parallel execution
(when using sequential execution, then it finishes after the first element of a collection).
In the service task instance the method getMultiInstanceActivityBehavior() returns null instead of a MultiInstanceBehavior.
I think in org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior you have to set the MultiInstanceActivityBehavior property:
The attached unit test shows the behaviour: instead of finishing the process it ends in an infinite loop.