removeAndTerminate

fun removeAndTerminate(task: Dispatcher.Task, waitStats: Boolean = false, afterTermination: (entity: ProcessModel.Entity) -> Unit? = null)(source)

Gives up a task waiting on the board and terminates the process of the load waiting for it: the task leaves the queue and ends cancelled, a vehicle already committed to it is released, and the load's process is terminated. The way for a model to withdraw a transport request; for a task nothing waits on, such as an errand, it cancels the task as cancel does. A load already aboard cannot be given up, since there is nowhere to set it down. It is not needed at the end of a replication, when every suspended entity is terminated anyway.

Parameters

task

the task to give up; one of this dispatcher's

waitStats

if true the wait is recorded in the queue's time in queue. The default is false, because a wait that was given up rather than served is not an observation of service.

afterTermination

invoked with the load once its process has been terminated