Package-level declarations

Types

Link copied to clipboard
class CordaFutureImpl<V>(impl: CompletableFuture<V> = CompletableFuture()) : Future<V> , OpenFuture<V>

Unless you really want this particular implementation, use openFuture to make one.

Link copied to clipboard

A CordaFuture with additional methods to complete it with a value, exception or the outcome of another future.

Link copied to clipboard
interface ValueOrException<in V>

The contravariant members of OpenFuture.

Functions

Link copied to clipboard
fun CordaFuture<*>.andForget(log: <Error class: unknown class>)

When this future is done and the outcome is failure, log the throwable.

Link copied to clipboard

Wrap a CompletableFuture, for example one that was returned by some API.

Link copied to clipboard
fun <V> doneFuture(value: V): CordaFuture<V>
Link copied to clipboard

Returns a future that will also apply the passed closure when it completes.

Link copied to clipboard

Returns a future that will also apply the passed closure on an error.

Link copied to clipboard
fun <V, W> CordaFuture<out V>.flatMap(transform: (V) -> CordaFuture<out W>): CordaFuture<W>

Returns a future that will have the same outcome as the future returned by the given transform. But if this future or the transform fails, the returned future's outcome is the same throwable. In the case where this future fails, the transform is not invoked.

Link copied to clipboard
fun <V> Executor.fork(block: () -> V): CordaFuture<V>
Link copied to clipboard
fun <V> Future<V>.get(timeout: Duration? = null): V
Link copied to clipboard
fun <V, W> CordaFuture<out V>.map(transform: (V) -> W): CordaFuture<W>

Returns a future that will have an outcome of applying the given transform to this future's value. But if this future fails, the transform is not invoked and the returned future becomes done with the same throwable.

Link copied to clipboard

Returns a future that will map an error thrown using the provided transform function.

Link copied to clipboard
Link copied to clipboard
fun <V, W, X> CordaFuture<out V>.thenMatch(success: (V) -> W, failure: (Throwable) -> X)

When this future is done, do match.

Link copied to clipboard

If all of the given futures succeed, the returned future's outcome is a list of all their values. The values are in the same order as the futures in the collection, not the order of completion. If at least one given future fails, the returned future's outcome is the first throwable that was thrown. Any subsequent throwables are added to the first one as suppressed throwables, in the order they are thrown. If no futures were given, the returned future has an immediate outcome of empty list. Otherwise the returned future does not have an outcome until all given futures have an outcome. Unlike Guava's Futures.allAsList, this method never hides failures/hangs subsequent to the first failure.