SupervisorJob

fun SupervisorJob(parent: Job? = null): CompletableJob(source)

Creates a supervisor job object in an active state. Children of a supervisor job can fail independently of each other.

A failure or cancellation of a child does not cause the supervisor job to fail and does not affect its other children, so a supervisor can implement a custom policy for handling failures of its children:

If a parent job is specified, then this supervisor job becomes a child job of parent and is cancelled when the parent fails or is cancelled. All this supervisor's children are cancelled in this case, too.