asDeferred

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.