Process completion procedure

What starts the procedure

Process completion happens when:

  • the last flownode of the process terminates (either normally or if a flownode is aborted/cancelled).

  • the process is aborted/cancelled

The procedure

There are three steps to the standard completion procedure:

  • unregisterEventSubProcess: we remove the waiting events associated with the subprocesses of the current process

  • handleProcessCompletion: we set the state of the process to what it needs to be (standard flow is to set is to Completed) and execute ON_FINISH process connectors.

  • We call childReachedState() to notify a potential callActivity that the process finished. If a callActivity started the process, childReachedState() will :

    • decrement the tokens of the callActivity.

    • register a work to execute the callActivity if the process that finished was the last of the callActivity processes.

Cancelling the process

Processes can be cancelled by using the API. All the flownodes and the process are put in the CANCELLING state, and works are registered to execute them all. The process is then put into the CANCELLED state without any other actions.

Aborting the process

  • If an error event has been fired by the current process, we trigger the end error events, and the process is put into state ABORTING.

  • When the process is in state aborting, the behavior is similar to that of the state CANCELLING. Processes are directly put in the state ABORTING if they are not aborted by error events.