From 796a0178c584084aba9b98a893e8ed2aa94a34b1 Mon Sep 17 00:00:00 2001 From: Dan Newton Date: Wed, 8 Jul 2020 16:53:52 +0100 Subject: [PATCH] NOTICK Add KDoc to `CordaFuture.doOnComplete` (#6449) --- .../net/corda/core/internal/concurrent/CordaFutureImpl.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/kotlin/net/corda/core/internal/concurrent/CordaFutureImpl.kt b/core/src/main/kotlin/net/corda/core/internal/concurrent/CordaFutureImpl.kt index dcaceb2295..0f62fd752f 100644 --- a/core/src/main/kotlin/net/corda/core/internal/concurrent/CordaFutureImpl.kt +++ b/core/src/main/kotlin/net/corda/core/internal/concurrent/CordaFutureImpl.kt @@ -27,6 +27,12 @@ fun CordaFuture.thenMatch(success: (V) -> W, failure: (Throwabl /** When this future is done and the outcome is failure, log the throwable. */ fun CordaFuture<*>.andForget(log: Logger) = thenMatch({}, { log.error("Background task failed:", it) }) +/** + * Returns a future that will also apply the passed closure when it completes. + * + * @param accept A function to execute when completing the original future. + * @return A future returning the same result as the original future that this function was executed on. + */ fun CordaFuture.doOnComplete(accept: (RESULT) -> Unit): CordaFuture { return CordaFutureImpl().also { result -> thenMatch({