OpenFuture

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

Inheritors

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
abstract fun cancel(p0: Boolean): Boolean
Link copied to clipboard
open fun capture(block: () -> V): Boolean

Run the given block (in the foreground) and set this future to its outcome.

Link copied to clipboard
open fun captureLater(f: CordaFuture<out V>)

When the given future has an outcome, make this future have the same outcome.

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
abstract fun get(): V
abstract operator fun get(p0: Long, p1: TimeUnit): V
Link copied to clipboard
fun <V> Future<V>.get(timeout: Duration? = null): V
Link copied to clipboard
fun <V> Future<V>.getOrThrow(timeout: Duration? = null): V

Same as Future.get except that the ExecutionException is unwrapped.

Link copied to clipboard
abstract fun isCancelled(): Boolean
Link copied to clipboard
abstract fun isDone(): Boolean
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
fun <V, W> Future<V>.match(success: (V) -> W, failure: (Throwable) -> W): W

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

Link copied to clipboard
abstract fun set(value: V): Boolean
Link copied to clipboard
abstract fun setException(t: Throwable): Boolean
Link copied to clipboard
abstract fun <W> then(callback: (CordaFuture<V>) -> W)

Run the given callback when this future is done, on the completion thread. If the completion thread is problematic for you e.g. deadlock, you can submit to an executor manually. If callback fails, its throwable is logged.

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
Link copied to clipboard
fun <A> CordaFuture<out A>.toObservable(): <Error class: unknown class><A>