vertx / io.vertx.reactivex.core / Context / executeBlocking

executeBlocking

open fun <T : Any> executeBlocking(blockingCodeHandler: Handler<Future<T>>, ordered: Boolean, resultHandler: Handler<AsyncResult<T>>): Unit

Safely execute some blocking code.

Executes the blocking code in the handler blockingCodeHandler using a thread from the worker pool.

When the code is complete the handler resultHandler will be called with the result on the original context (e.g. on the original event loop of the caller).

A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, the handler should call the io.vertx.reactivex.core.Future#complete or io.vertx.reactivex.core.Future#complete method, or the io.vertx.reactivex.core.Future#fail method if it failed.

Parameters

blockingCodeHandler - handler representing the blocking code to run

ordered - if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees

resultHandler - handler that will be called when the blocking code is complete

open fun <T : Any> executeBlocking(blockingCodeHandler: Handler<Future<T>>, resultHandler: Handler<AsyncResult<T>>): Unit

Invoke io.vertx.reactivex.core.Context#executeBlocking with order = true.

Parameters

blockingCodeHandler - handler representing the blocking code to run

resultHandler - handler that will be called when the blocking code is complete