https://kotlinlang.org logo
Title
v

vngantk

03/07/2019, 9:23 AM
Has anyone implemented the Zookeeper distributed lock recipe using coroutines? The examples given in Zookeeper site and those provided by the Curator framework are of blocking mode. Since Zookeeper also provides async version for its API, I think it is possible to use its async API to implement a coroutines version of distributed lock.
v

Vsevolod Tolstopyatov [JB]

03/07/2019, 2:12 PM
I’ve used to play with that. There is nothing hard in general, instead of blocking you suspend and then resume coroutine from the watcher on target events. But (AFAIK) curator was not designed for asynchronous primitives, so adding coroutins-based version of primitives require a lot of engineering effort