Package io.vertx.core

## Interface WorkerExecutor

- All Superinterfaces:
    `Measured`

      public interface WorkerExecutor
      extends Measured

  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.

  Author:
    Julien Viet

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Future<Void>` | `close()` | Close the executor.
    `default <T> Future<T>` | `executeBlocking​(Callable<T> blockingCodeHandler)` | Like `executeBlocking(Callable, boolean)` called with ordered = true.
    `<T> Future<T>` | `executeBlocking​(Callable<T> blockingCodeHandler, boolean ordered)` | Safely execute some blocking code.

    - ### Methods inherited from interface io.vertx.core.metrics.Measured

      `isMetricsEnabled`

- - ### Method Detail

    - #### executeBlocking

          <T> Future<T> executeBlocking​(Callable<T> blockingCodeHandler,
                                        boolean ordered)

      Safely execute some blocking code.

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

      The returned future will be completed with the result on the original context (i.e. on the original event loop of the caller) or failed when the handler throws an exception.

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

      Type Parameters:
        `T` - the type of the result
      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
      Returns:
        a future notified with the result

    - #### executeBlocking

          default <T> Future<T> executeBlocking​(Callable<T> blockingCodeHandler)

      Like `executeBlocking(Callable, boolean)` called with ordered = true.

    - #### close

          Future<Void> close()

      Close the executor.