CompletableFuture -> Deferred


#1

I have to use a Java lib (ArangoDB async driver) with methods returning CompletableFuture instances.

I’m creating a façade and I’d like to avoid exposing CompletableFuture. Instead, I want to expose Deferred instances.

My first attempt looks like this:

fun find(id: String): Deferred = async {
val document: CompletableFuture = collection.getDocument(id, c)
document.await()
}

Is there a better way to do this?


#2

#3

That’s great! When should it be available in Maven repos ?


#4