public class ConcurrencyUtils
Modifier and Type | Method and Description |
---|---|
static <V,W> CordaFuture<W> |
firstOf(CordaFuture<V>[] futures,
kotlin.jvm.functions.Function1<? super net.corda.core.concurrent.CordaFuture<? extends V>,? extends W> handler)
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.
|
static <V,W> W |
match(java.util.concurrent.Future<V> $receiver,
kotlin.jvm.functions.Function1<? super V,? extends W> success,
kotlin.jvm.functions.Function1<? super java.lang.Throwable,? extends W> failure)
Invoke getOrThrow and pass the value/throwable to success/failure respectively.
|
public static <V,W> W match(java.util.concurrent.Future<V> $receiver, kotlin.jvm.functions.Function1<? super V,? extends W> success, kotlin.jvm.functions.Function1<? super java.lang.Throwable,? extends W> failure)
Invoke getOrThrow and pass the value/throwable to success/failure respectively.
public static <V,W> CordaFuture<W> firstOf(CordaFuture<V>[] futures, kotlin.jvm.functions.Function1<? super net.corda.core.concurrent.CordaFuture<? extends V>,? extends W> handler)
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.