Multi instance implementation in the process engine is not as good as it should be.
The main problems is that multi instance is implemented at the activity behavior level and not at the atomic operation level as it should be.
This causes many problems.
The refactoring contains:
- multi instance: For each multi-instance activity, there is now an additional activity, called the multi-instance body, that contains the actual activity (this corresponds to the BPMN spec notion, that multi-instance activities are contained in a distinct scope)
- error propagation: removes the ErrorPropagation class and makes it part of the AbstractBpmnActivityBehavior
- event subprocess: ensures that event subprocesses are now scopes
- leaving activities via sequence flows: instead of taking transitions when the activity is executed, transitions are only scheduled to be taken and are actually taken after the current scope has been destroyed; fixes issues that activity end listeners were invoked with each outgoing transition before
- proper differentiation between scopes: An activity has now only two kinds of scopes: flow scope and event scope
- creation of concurrent executions: boiled down to three cases (+ one for instances started in a previous version, see next line)
- avoid creation of concurrent, scope execution. Before, it was possible that by triggering a non-interrupting event, such an execution was created
- proper differentiation between cancelling (e.g. boundary event) and interrupting (e.g. terminated end event) activities