Kotlin Coroutines 1.5: GlobalScope marked as delicate, refined Channels API, and more

preview_player
Показать описание
Kotlin Coroutines 1.5.0 is out! Here’s what the new version brings.

The event will feature a live Q&A session with the Kotlin team.
🗓 May 25, 2021 16:00 – 17:30 CEST

GlobalScope is now marked as a delicate API. GlobalScope is an advanced API that is easy to misuse. The compiler will now warn you about possible misuse and require an opt-in for this class in your program.

Extensions for JUnit. CoroutinesTimeout is now available for JUnit 5.

The refined Channel API. Along with a new naming scheme for the library functions, the non-suspending functions `trySend` and `tryReceive` were introduced as better alternatives to `offer` and `poll`.

Stabilization of Reactive Integrations. We added more functions for converting from Reactive Streams types to Kotlin Flow and back, stabilized many existing functions and ReactiveContext API.

#Kotlin #Coroutines
Рекомендации по теме
Комментарии
Автор

trySend and tryReceive are definitely much better names. I like the change.

Salamakii
Автор

Super excited to see the conversation between Flow and Rx Observable 😃

prokash_sarkar
Автор

Can we have some samples that showcase flow support for project reactor in spring boot, how can we actually make parallel API calls and aggregate the response with flow and send back response

supreethhs
Автор

Waiting for Flow APIs to be completely stable. callbackflow is stable but awaitClose, trySend are still marked experimental.

wishnuprathikantam
Автор

I attempted a microservice with KTOR about a year ago, and I wasn't convinced by the coroutine model at all. Debugging was a hot mess, and third-party libraries often rely on ThreadLocal and synchronized - both of which simply don't work in a coroutine environment. The main issue is that kotlin coroutines are a language / library feature, not a platform feature - the JVM treats them like any other object. My hope is that Project Fiber will eventually come to the JVM, with proper integration to everything. Until then: classic spring boot it is.

AlanDarkworld