Package-level declarations

Types

Link copied to clipboard
interface CordaFuture<V> : Future<V>

Same as Future with additional methods to provide some of the features of java.util.concurrent.CompletableFuture while minimising the API surface area. In Kotlin, to avoid compile errors, whenever CordaFuture is used in a parameter or extension method receiver type, its type parameter should be specified with out variance.

Functions

Link copied to clipboard
fun <V, W> firstOf(vararg futures: CordaFuture<out V>, handler: (CordaFuture<out V>) -> W): CordaFuture<W>

As soon as a given future becomes done, the handler is invoked with that future as its argument. The result of the handler is copied into the result future, and the handler isn't invoked again. If a given future errors after the result future is done, the error is automatically logged.

Link copied to clipboard
fun <V, W> Future<V>.match(success: (V) -> W, failure: (Throwable) -> W): W

Invoke getOrThrow and pass the value/throwable to success/failure respectively.