tuweni / org.apache.tuweni.concurrent / AsyncCompletion

AsyncCompletion

interface AsyncCompletion (source)

A completion that will be complete at a future time.

Properties

COMPLETED

static val COMPLETED: AsyncCompletion!

Functions

accept

Returns a new completion that completes successfully, after executing the given function with this completion's exception (if any).

abstract fun accept(consumer: Consumer<in Throwable!>!): AsyncCompletion!

allOf

Returns an AsyncCompletion that completes when all of the given completions complete. If any completions complete exceptionally, then the resulting completion also completes exceptionally.

open static fun allOf(vararg cs: AsyncCompletion!): AsyncCompletion!
open static fun allOf(cs: MutableCollection<AsyncCompletion!>!): AsyncCompletion!
open static fun allOf(cs: Stream<AsyncCompletion!>!): AsyncCompletion!

cancel

Attempt to cancel execution of this task.

abstract fun cancel(): Boolean

completed

Return an already completed completion.

open static fun completed(): AsyncCompletion!

exceptional

Return an already failed completion, caused by the given exception.

open static fun exceptional(ex: Throwable!): AsyncCompletion!

exceptionally

Returns a new completion that, when this result completes exceptionally, completes after executing the supplied function. Otherwise, if this result completes normally, then the returned result also completes normally with the same value.

abstract fun exceptionally(consumer: Consumer<in Throwable!>!): AsyncCompletion!

executeBlocking

Returns a completion that completes after the given blocking action executes asynchronously on ForkJoinPool#commonPool().

open static fun executeBlocking(action: Runnable!): AsyncCompletion!

Returns a completion that completes after the given blocking action executes asynchronously on an Executor.

open static fun executeBlocking(executor: Executor!, action: Runnable!): AsyncCompletion!

Returns a completion that completes after the given blocking action executes asynchronously on a vertx context.

open static fun executeBlocking(vertx: Vertx!, action: Runnable!): AsyncCompletion!

Returns a completion that completes after the given blocking action executes asynchronously on a vertx executor.

open static fun executeBlocking(executor: WorkerExecutor!, action: Runnable!): AsyncCompletion!

handle

Returns a new result that, when this result completes either normally or exceptionally, completes with the value obtained from executing the supplied function with this result's exception (if any) as an argument.

abstract fun <U : Any!> handle(fn: Function<in Throwable!, out U>!): AsyncResult<U>!

incomplete

Return an incomplete completion, that can be later completed or failed.

open static fun incomplete(): CompletableAsyncCompletion!

isCancelled

Returns true if this task was cancelled before it completed normally.

abstract fun isCancelled(): Boolean

isCompletedExceptionally

Returns true if completed exceptionally or cancelled.

abstract fun isCompletedExceptionally(): Boolean

isDone

Returns true if completed normally, completed exceptionally or cancelled.

abstract fun isDone(): Boolean

join

Waits if necessary for the computation to complete.

abstract fun join(): Unit

Waits if necessary for at most the given time for the computation to complete.

abstract fun join(timeout: Long, unit: TimeUnit!): Unit

runOnContext

Returns a completion that, after the given function executes on a vertx context and returns a completion, completes when the completion from the function does.

open static fun runOnContext(vertx: Vertx!, fn: Supplier<out AsyncCompletion!>!): AsyncCompletion!

Returns a completion that completes after the given action executes on a vertx context.

open static fun runOnContext(vertx: Vertx!, action: Runnable!): AsyncCompletion!

then

Returns a new completion that, when this completion completes normally, completes with the same value or exception as the result returned after executing the given function.

abstract fun <U : Any!> then(fn: Supplier<out AsyncResult<U>!>!): AsyncResult<U>!

thenApply

Returns a result that, when this completion and the other result both complete normally, completes with the value obtained from executing the supplied function with the value from the other result as an argument.

abstract fun <U : Any!, V : Any!> thenApply(other: AsyncResult<out U>!, fn: Function<in U, out V>!): AsyncResult<V>!

thenCombine

Returns a completion that completes when both this completion and the other complete normally.

abstract fun thenCombine(other: AsyncCompletion!): AsyncCompletion!

thenCompose

When this result completes normally, invokes the given function with the resulting value and obtain a new AsyncCompletion.

abstract fun thenCompose(fn: Supplier<out AsyncCompletion!>!): AsyncCompletion!

thenConsume

Returns a completion that, when this completion and the supplied result both complete normally, completes after executing the supplied function with the value from the supplied result as an argument.

abstract fun <U : Any!> thenConsume(other: AsyncResult<out U>!, consumer: Consumer<in U>!): AsyncCompletion!

thenRun

Returns a new completion that, when this completion completes normally, completes after given action is executed.

abstract fun thenRun(runnable: Runnable!): AsyncCompletion!

thenSchedule

Returns a new result that, when this completion completes normally, completes with the same value or exception as the completion returned after executing the given function on the vertx context.

abstract fun <U : Any!> thenSchedule(vertx: Vertx!, fn: Supplier<out AsyncResult<U>!>!): AsyncResult<U>!

thenScheduleBlockingRun

Returns a new completion that, when this completion completes normally, completes after the given blocking action is executed on the vertx context.

abstract fun thenScheduleBlockingRun(vertx: Vertx!, runnable: Runnable!): AsyncCompletion!

Returns a new completion that, when this completion completes normally, completes after the given blocking action is executed on the vertx executor.

abstract fun thenScheduleBlockingRun(executor: WorkerExecutor!, runnable: Runnable!): AsyncCompletion!

thenScheduleRun

Returns a new completion that, when this completion completes normally, completes after the given action is executed on the vertx context.

abstract fun thenScheduleRun(vertx: Vertx!, runnable: Runnable!): AsyncCompletion!

thenSupply

Returns a completion that, when this result completes normally, completes with the value obtained after executing the supplied function.

abstract fun <U : Any!> thenSupply(supplier: Supplier<out U>!): AsyncResult<U>!

Returns a completion that, when this result completes normally, completes with the value obtained after executing the supplied function on the vertx context.

abstract fun <U : Any!> thenSupply(vertx: Vertx!, supplier: Supplier<out U>!): AsyncResult<U>!

toFuture

Returns the underlying future associated with this instance. Note taking action directly on this future will impact this object.

abstract fun toFuture(): Future<Void!>!

whenComplete

Returns a new completion that completes in the same manner as this completion, after executing the given function with this completion's exception (if any).

abstract fun whenComplete(consumer: Consumer<in Throwable!>!): AsyncCompletion!

Inheritors

CompletableAsyncCompletion

An AsyncCompletion that can later be completed successfully or with a provided exception.

interface CompletableAsyncCompletion : AsyncCompletion