kotlinx.coroutines v0.25.0 Release Notes
-
- ๐ Major rework on exception-handling and cancellation in coroutines (see #333, #452 and #451):
- New ["Exception Handling" section in the guide](docs/topics/coroutines-guide.md#exception-handling) explains exceptions in coroutines.
- Semantics of
Job.cancel
resultingBoolean
value changed —true
means exception was handled by the job, caller shall handle otherwise. - Exceptions are properly propagated from children to parents.
- Installed
CoroutineExceptionHandler
for a family of coroutines receives one aggregated exception in case of failure. - Change
handleCoroutineException
contract, so custom exception handlers can't break coroutines machinery. - Unwrap
JobCancellationException
properly to provide exception transparency over whole call chain.
- ๐ Introduced support for thread-local elements in coroutines context (see #119):
ThreadContextElement
API for custom thread-context sensitive context elements.ThreadLocal.asContextElement()
extension function to convert an arbitrary thread-local into coroutine context element.- New ["Thread-local data" subsection in the guide](docs/topics/coroutines-guide.md#thread-local-data) with examples.
- SLF4J Mapped Diagnostic Context (MDC) integration is provided via
MDCContext
element defined in [kotlinx-coroutines-slf4j
](integration/kotlinx-coroutines-slf4j/README.md) integration module.
- ๐ Introduced IO dispatcher to offload blocking I/O-intensive tasks (see #79).
- ๐ Introduced
ExecutorCoroutineDispatcher
instead ofCloseableCoroutineDispatcher
(see #385). - Built with Kotlin 1.2.61 and Kotlin/Native 0.8.2.
- ๐ JAR files for
kotlinx-coroutines
are now JEP 238 multi-release JAR files.- On JDK9+
VarHandle
is used for atomic operations instead ofAtomic*FieldUpdater
for better performance. - See AtomicFu project for details.
- On JDK9+
- ๐ Reversed addition of
BlockingChecker
extension point to control whererunBlocking
can be used (see #227).runBlocking
can be used anywhere without limitations (again), but it would still cause problems if improperly used on UI thread.
- ๐ Corrected return-type of
EventLoop
pseudo-constructor (see #477, PR by @Groostav). - ๐ Fixed
as*Future()
integration functions to catch allThrowable
exceptions (see #469). - ๐ Fixed
runBlocking
cancellation (see #501). - ๐ Fixed races and timing bugs in
withTimeoutOrNull
(see #498). - ๐ Execute
EventLoop.invokeOnTimeout
inDefaultDispatcher
to allow busy-wait loops insiderunBlocking
(see #479). - โ Removed
kotlinx-coroutines-io
module from the project, it has moved to kotlinx-io. - ๐ Provide experimental API to create limited view of experimental dispatcher (see #475).
- ๐ Various minor fixes by @LouisCAD, @Dmitry-Borodin.
- ๐ Major rework on exception-handling and cancellation in coroutines (see #333, #452 and #451):