removeAllAndTerminate

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

Removes and terminates all the requests waiting in the queue: exactly those waiting when it is called. Every one leaves the queue before any entity is terminated, so the units a termination frees cannot serve another of them; each entity is terminated once, even with several requests here; and the units they leave are offered once all are terminated.

A running process cannot be terminated, so this throws, before anything is removed, if the entity of any waiting request is running now; check that each entity's currentProcess is not running first.

Parameters

waitStats

if true the waiting time statistics are collected on the usage of the queue. The default is false.

afterTermination

a function to invoke after the process is successfully terminated