terminateProcess

fun terminateProcess(afterTermination: (entity: ProcessModel.Entity) -> Unit? = null)

If the entity is executing a process and the process is suspended, then the process routine is terminated. This causes the currently suspended process to exit, essentially with an error condition. No further processing within the process will execute. The process ends (is terminated). All resources that the entity has allocated will be deallocated. If the entity was waiting in a queue, the entity is removed from the queue and no statistics are collected on its queueing. If the entity is experiencing a delay, then the event associated with the delay is cancelled.

If the entity has additional processes in its process sequence they are not automatically executed. If the user requires specific behavior to occur for the entity after termination, then the user should override the Entity's handleTerminatedProcess() function to supply specific logic. Termination happens immediately, with no time delay.

Parameters

afterTermination

a function to invoke after the process is successfully terminated