4. Picking right the stack
• It’s hard to look into future, and depends a lot on your context!
• Key factors:
• Solid community & ecosystem
• Truly multithreaded - no GILs or bottle necks
• Async IO and Multi-reactor pattern
16. Fragmentation
Future/CompletionStage/Deferred/Mono/ListenableFuture/Promise/…
• Java CompletionStage/Future/Stream - Early concepts popularized Java 5 by FutureTask.
• Reactor - Spring de-facto.
• RxJava - Rx 2 vs Rx 3 has major difference (https://github.com/ReactiveX/RxJava/wiki/
What%27s-different-in-3.0).
• Vert.x - Has it’s own AsyncResult<T> with interoperability with CompletionStage
• Mutiny - new kid on the block.
• Quasar - inspired by Erlang and Go (Possibly dead).
• Akka - Powerful actor & message driven.
• Google Guava - ListenableFuture<T> 🤦
• And more 🤦🤦🤦
20. A timeline for async/await pattern
• The async/await pattern was
f
irst added in F# in 2007
• Made it’s way to C# around 2011
• Python 3.5 added support in 2015
• Typescript 1.7 added support in 2015
• Javascript added it part of ECMAScript 2017
43. Dealing with async fragmentation…
Out of box extensions
• kotlinx-coroutines-jdk8
• kotlinx-coroutines-jdk9
• kotlinx-coroutines-reactive
• kotlinx-coroutines-reactor
• kotlinx-coroutines-rx2
• Kotlinx-coroutines-rx3
• kotlinx-coroutines-guava
• Kotlinx-coroutines-play-service
44. What about legacy thread blocking calls?
mono.publishOn(Schedulers.boundedElastic()
)
.map(v ->
{
// Do blocking operatio
n
}
)
.publishOn(Schedulers.parallel())
;
withContext(Dispatchers.IO)
{
// Do blocking operation
}
45. Kotlin coroutines has more!
• Control over structured concurrency using:
• Coroutine scopes, contexts, and dispatchers
• Dispatching constructs withContext, async, and launch
• Flows, Channels, and Actors!
• Spring Framework 5.2+ has full coroutine support
• Awesome reactor interoperability with coroutines