You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kotlinx-coroutines-jdk8and kotlinx-coroutines-guava integration modules' future { ... } builders do not honor structured concurrency in the same way as all other builders -- a failure inside the child (builder) code did not cancel the parent coroutine. This change is to address this discrepancy and to bring them inline with all the the other builders, both core ones (launch, async, produce, etc) and from other integration modules (rxSingle, publish, etc).
Note that this change does not affect non-structured (typical) usage like GlobalScope.future { ... }.
Please note, that there is an open design issue (#763) regarding async { ... } and this change "deepends" this problem by bringing future { ... } inline with this structured concurrency behaviour. However, this is not a major issue for future { ... } since it is integration vehicle that is typically used to adapt suspending function to the Java code that expects a future result like this:
suspend fun doSomething(): T { .... } // Kotlin fun
fun doSomethingAsync(): CompletableFuture<T> = GlobalScope.future { // Java fun
doSomething()
}
The text was updated successfully, but these errors were encountered:
BREAKING BEHAVIOR CHANGE:
* kotlinx-coroutines-jdk8 and -guava integration modules
future { ... } builders now honor structured concurrency in
the same way as all other builders -- a failure inside the child
(builder) code now cancels parent coroutine.
Note that is does not affect non-structured (typical) usage like
GlobalScope.future { ... }
MINOR BEHAVIOR CHANGE:
* Exception in installed CancellableCoroutine.invokeOnCancellation
handler does not cancel the parent job, but is considered to be an
uncaught exception, so it goes to CoroutineExceptionHandler.
Internal changes:
* JobSupport.cancelsParents=true is now a default, since there are
only a fewer exceptions for builder that throw their exception from block
* JobSupport.handleJobException has additional "handled" parameter to
distinguish cases when parent did/did-not handle it.
* handleCoroutineException logic is updated. It never cancels parent,
since parent cancellation is taken care of by structured concurrency.
* handleCoroutineException is always invoked with current coroutine's
context (as opposed to parent)
Fixes#1007
BREAKING BEHAVIOR CHANGE:
* kotlinx-coroutines-jdk8 and -guava integration modules
future { ... } builders now honor structured concurrency in
the same way as all other builders -- a failure inside the child
(builder) code now cancels parent coroutine.
Note that is does not affect non-structured (typical) usage like
GlobalScope.future { ... }
MINOR BEHAVIOR CHANGE:
* Exception in installed CancellableCoroutine.invokeOnCancellation
handler does not cancel the parent job, but is considered to be an
uncaught exception, so it goes to CoroutineExceptionHandler.
Internal changes:
* JobSupport.cancelsParents=true is now a default, since there are
only a fewer exceptions for builder that throw their exception from block
* JobSupport.handleJobException has additional "handled" parameter to
distinguish cases when parent did/did-not handle it.
* handleCoroutineException logic is updated. It never cancels parent,
since parent cancellation is taken care of by structured concurrency.
* handleCoroutineException is always invoked with current coroutine's
context (as opposed to parent)
Fixes#1007
kotlinx-coroutines-jdk8
andkotlinx-coroutines-guava
integration modules'future { ... }
builders do not honor structured concurrency in the same way as all other builders -- a failure inside the child (builder) code did not cancel the parent coroutine. This change is to address this discrepancy and to bring them inline with all the the other builders, both core ones (launch
,async
,produce
, etc) and from other integration modules (rxSingle
,publish
, etc).Note that this change does not affect non-structured (typical) usage like
GlobalScope.future { ... }
.Please note, that there is an open design issue (#763) regarding
async { ... }
and this change "deepends" this problem by bringingfuture { ... }
inline with this structured concurrency behaviour. However, this is not a major issue forfuture { ... }
since it is integration vehicle that is typically used to adapt suspending function to the Java code that expects a future result like this:The text was updated successfully, but these errors were encountered: