close

open override fun close()

Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. This method waits until all tasks have completed execution and the executor has terminated.

If interrupted while waiting, this method stops all executing tasks as if by invoking .shutdownNow. It then continues to wait until all actively executing tasks have completed. Tasks that were awaiting execution are not executed. The interrupt status will be re-asserted before this method returns.

If already terminated, invoking this method has no effect.

Since

19

Throws

SecurityException

if a security manager exists and shutting down this ExecutorService may manipulate threads that the caller is not permitted to modify because it does not hold [ ]("modifyThread"), or the security manager's checkAccess method denies access.