interface AsyncResult<T : Any>
(source)
A result that will be available at a future time.
- The type of the result object.
abstract fun accept(consumer: BiConsumer<in T, Throwable>): AsyncCompletion
Returns a new completion that, when this result completes either normally or exceptionally, completes after executing the supplied function with this result's value and exception as arguments. Either the value or the exception supplied to the function will be |
|
open static fun allOf(vararg rs: AsyncResult<*>): AsyncCompletion open static fun allOf(rs: MutableCollection<out AsyncResult<*>>): AsyncCompletion open static fun allOf(rs: Stream<out AsyncResult<*>>): AsyncCompletion
Returns an AsyncCompletion that completes when all of the given results complete. If any results complete exceptionally, then the resulting completion also completes exceptionally. |
|
abstract fun cancel(): Boolean
Attempt to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when After this method returns, subsequent calls to |
|
open static fun <T : Any> combine(rs: MutableCollection<out AsyncResult<out T>>): AsyncResult<MutableList<T>> open static fun <T : Any> combine(rs: Stream<out AsyncResult<out T>>): AsyncResult<MutableList<T>>
Returns a result that completes when all of the given results complete. If any results complete exceptionally, then the resulting completion also completes exceptionally. |
|
open static fun <T : Any> completed(value: T?): AsyncResult<T>
Return an already completed result containing the given value. |
|
open static fun <T : Any> exceptional(ex: Throwable): AsyncResult<T>
Return an already failed result, caused by the given exception. |
|
abstract fun exceptionally(fn: Function<Throwable, out T>): AsyncResult<T>
Returns a new result that, when this result completes exceptionally, completes with the value obtained from executing the supplied function with this result's exception as an argument. Otherwise, if this result completes normally, then the returned result also completes normally with the same value. |
|
open static fun <T : Any> executeBlocking(fn: Supplier<T>): AsyncResult<T>
Returns a result that, after the given blocking function executes asynchronously on open static fun <T : Any> executeBlocking(executor: Executor, fn: Supplier<T>): AsyncResult<T>
Returns a result that, after the given blocking function executes asynchronously on an Executor and returns a result, completes when the returned result completes, with the same value or exception. open static fun <T : Any> executeBlocking(vertx: Vertx, fn: Supplier<T>): AsyncResult<T>
Returns a result that, after the given blocking function executes asynchronously on a vertx context and returns a result, completes when the returned result completes, with the same value or exception. open static fun <T : Any> executeBlocking(executor: WorkerExecutor, fn: Supplier<T>): AsyncResult<T>
Returns a result that, after the given blocking function executes asynchronously on a vertx executor and returns a result, completes when the returned result completes, with the same value or exception. |
|
abstract fun get(): T?
Waits if necessary for the computation to complete, and then retrieves its result. abstract fun get(timeout: Long, unit: TimeUnit): T?
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result. |
|
abstract fun <U : Any> handle(fn: BiFunction<in T, Throwable, out U>): AsyncResult<U>
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 value and exception as arguments. Either the value or the exception supplied to the function will be |
|
open static fun <T : Any> incomplete(): CompletableAsyncResult<T>
Return an incomplete result, that can be later completed or failed. |
|
abstract fun isCancelled(): Boolean
Returns |
|
abstract fun isCompletedExceptionally(): Boolean
Returns |
|
abstract fun isDone(): Boolean
Returns |
|
open static fun <T : Any> runOnContext(vertx: Vertx, fn: Supplier<out AsyncResult<T>>): AsyncResult<T>
Returns a result that, after the given function executes on a vertx context and returns a result, completes when the returned result completes, with the same value or exception. Note that the given function is run directly on the context and should not block. |
|
abstract fun <U : Any> then(fn: Function<in T, out AsyncResult<U>>): AsyncResult<U>
Returns a new result that, when this result completes normally, completes with the same value or exception as the result returned after executing the given function with this results value as an argument. |
|
abstract fun thenAccept(consumer: Consumer<in T>): AsyncCompletion
Returns a completion that, when this result completes normally, completes after executing the supplied consumer with this result's value as an argument. |
|
abstract fun <U : Any> thenAcceptBoth(other: AsyncResult<out U>, consumer: BiConsumer<in T, in U>): AsyncCompletion
Returns a completion that, when this result and the other result both complete normally, completes after executing the supplied consumer with both this result's value and the value from the other result as arguments. |
|
abstract fun <U : Any> thenApply(fn: Function<in T, out U>): AsyncResult<U>
Returns a result that, when this result completes normally, completes with the value obtained from executing the supplied function with this result's value as an argument. |
|
abstract fun <U : Any, V : Any> thenCombine(other: AsyncResult<out U>, fn: BiFunction<in T, in U, out V>): AsyncResult<V>
Returns a result that, when this result and the other result both complete normally, completes with the value obtained from executing the supplied function with both this result's value and the value from the other result as arguments. |
|
abstract fun thenCompose(fn: Function<in T, out AsyncCompletion>): AsyncCompletion
When this result completes normally, invokes the given function with the resulting value and obtains a new AsyncCompletion. |
|
abstract fun thenRun(runnable: Runnable): AsyncCompletion
Returns a new completion that, when this result completes normally, completes after given action is executed. |
|
abstract fun <U : Any> thenSchedule(vertx: Vertx, fn: Function<in T, out AsyncResult<U>>): AsyncResult<U>
Returns a new result that, when this result completes normally, completes with the same value or exception as the completion returned after executing the given function on the vertx context with this results value as an argument. |
|
abstract fun <U : Any> thenScheduleApply(vertx: Vertx, fn: Function<in T, out U>): AsyncResult<U>
Returns a result that, when this result completes normally, completes with the value obtained from executing the supplied function on the vertx context with this result's value as an argument. |
|
abstract fun <U : Any> thenScheduleBlockingApply(vertx: Vertx, fn: Function<in T, out U>): AsyncResult<U>
Returns a result that, when this result completes normally, completes with the value obtained from executing the supplied blocking function on the vertx context with this result's value as an argument. abstract fun <U : Any> thenScheduleBlockingApply(executor: WorkerExecutor, fn: Function<in T, out U>): AsyncResult<U>
Returns a result that, when this result completes normally, completes with the value obtained from executing the supplied blocking function on the vertx executor with this result's value as an argument. |
|
abstract fun thenScheduleBlockingRun(vertx: Vertx, runnable: Runnable): AsyncCompletion
Returns a new completion that, when this result completes normally, completes after the given blocking action is executed on the vertx context. abstract fun thenScheduleBlockingRun(executor: WorkerExecutor, runnable: Runnable): AsyncCompletion
Returns a new completion that, when this result completes normally, completes after the given blocking action is executed on the vertx executor. |
|
abstract fun thenScheduleRun(vertx: Vertx, runnable: Runnable): AsyncCompletion
Returns a new completion that, when this result completes normally, completes after the given action is executed on the vertx context. |
|
abstract fun whenComplete(action: BiConsumer<in T, in Throwable>): AsyncResult<T>
Returns a new result that completes with the same value or exception as this result, after executing the given action with this result's value or exception. Either the value or the exception supplied to the action will be |
fun <T> AsyncResult<T>.asDeferred(): Deferred<T>
Converts this AsyncResult to an instance of Deferred. The AsyncResult is cancelled when the resulting deferred is cancelled. |
|
suspend fun <T> AsyncResult<T>.await(): T
Awaits for completion of the AsyncResult without blocking a thread. |
interface CompletableAsyncResult<T : Any> : AsyncResult<T>
An AsyncResult that can be later completed successfully with a provided value, or completed with an exception. |