I've added method addInstances to ParallelMultiInstanceBehavior and it works.
I've modified createInstances loop to retrieve nrOfInstances for each loop step:
[java]
nrOfInstances = (Integer) execution.getVariableLocal(NUMBER_OF_INSTANCES);
[/java]
And when I need it I just call addInstances for parent (scope) execution:
[java]
// executionEntity is a "ConcurrentExecution"
int additionalNrOfInstances = 5; // I want to add 5 more executions
ExecutionEntity parentExecution = executionEntity.getParent();
if (parentExecution.getActivity().getActivityBehavior() instanceof ParallelMultiInstanceBehavior) {
ParallelMultiInstanceBehavior behavior = ((ParallelMultiInstanceBehavior)parentExecution.getActivity().getActivityBehavior();
behavior.addInstances(parentExecution, additionalNrOfInstances);
}
[/java]