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

Awaits for completion of CompletionStage without blocking a thread.

This suspending function is cancellable. If the Job of the current coroutine is cancelled while this suspending function is waiting, this function stops waiting for the completion stage and immediately resumes with CancellationException.

This method is intended to be used with one-shot futures, so on coroutine cancellation the CompletableFuture that corresponds to this CompletionStage (see CompletionStage.toCompletableFuture) is cancelled. If cancelling the given stage is undesired, stage.asDeferred().await() should be used instead.