Greg Stepniewski
08/30/2019, 7:57 AMIf a coroutine encounters exception other than CancellationException, it cancels its parent with that exception. This behaviour cannot be overridden and is used to provide stable coroutines hierarchies for structured concurrency.However, you have SupervisorJob which says
A failure or cancellation of a child does not cause the supervisor job to fail and does not affect its other children.These two seem to contradict, since SupervisorJob clearly overrides the behaviour of children cancelling their parent on failure - or am I missing something?
Can Orhan
08/30/2019, 8:03 AMJob
does, however, make this distinction explicit By default, a failure of any of the job's children leads to an immediate failure of its parent and cancellation of the rest of its children. This behavior can be customized using SupervisorJob.
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/index.htmlMatej Drobnič
08/30/2019, 8:05 AMGreg Stepniewski
08/30/2019, 8:05 AMCan Orhan
08/30/2019, 8:15 AMSupervisorJob
streetsofboston
08/30/2019, 12:13 PM