An executor for executing blocking code in Vert.x .

It provides the same executeBlocking operation than Context and Vertx but on a separate worker pool.

no subtypes hierarchy

Initializer
WorkerExecutor(WorkerExecutor unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
closeshared default void close()

Close the executor.

executeBlockingshared default void executeBlocking<T>(Anything(Future<T?>) blockingCodeHandler, Anything(Throwable|T?) resultHandler)

Like executeBlocking called with ordered = true.

executeBlockingshared default void executeBlocking<T>(Anything(Future<T?>) blockingCodeHandler, Boolean ordered, Anything(Throwable|T?) resultHandler)

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 (i.e. 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 complete or complete method, or the fail method if it failed.

In the blockingCodeHandler the current context remains the original context and therefore any task scheduled in the blockingCodeHandler will be executed on the this context and not on the worker thread.

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

isMetricsEnabledshared actual default Boolean isMetricsEnabled()

Whether the metrics are enabled for this measured object

Inherited Methods
Methods inherited from: Object
equals
Methods inherited from: Measured