Extensions for java.util.concurrent.CompletionStage


fun <T> CompletionStage<T>.asDeferred(): Deferred<T>

Converts this completion stage to an instance of Deferred. When this completion stage is an instance of Future, then it is cancelled when the resulting deferred is cancelled.


suspend fun <T> CompletionStage<T>.await(): T

Awaits for completion of the completion stage without blocking a thread.