Class WorkerExecutor

java.lang.Object
io.vertx.reactivex.core.WorkerExecutor
All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate, Measured

public class WorkerExecutor extends Object implements io.vertx.lang.rx.RxDelegate, 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.

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.

  • Field Details

    • __TYPE_ARG

      public static final io.vertx.lang.rx.TypeArg<WorkerExecutor> __TYPE_ARG
  • Constructor Details

    • WorkerExecutor

      public WorkerExecutor(WorkerExecutor delegate)
    • WorkerExecutor

      public WorkerExecutor(Object delegate)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDelegate

      public WorkerExecutor getDelegate()
      Specified by:
      getDelegate in interface Measured
      Specified by:
      getDelegate in interface io.vertx.lang.rx.RxDelegate
    • isMetricsEnabled

      public boolean isMetricsEnabled()
      Whether the metrics are enabled for this measured object
      Specified by:
      isMetricsEnabled in interface Measured
      Returns:
      true if metrics are enabled
    • close

      public Future<Void> close()
      Close the executor.
      Returns:
    • rxClose

      public Completable rxClose()
      Close the executor.
      Returns:
    • executeBlocking

      public <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.

      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
    • rxExecuteBlocking

      public <T> Maybe<T> rxExecuteBlocking(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.

      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

      public <T> Future<T> executeBlocking(Callable<T> blockingCodeHandler)
      Like executeBlocking(Callable, boolean) called with ordered = true.
      Parameters:
      blockingCodeHandler -
      Returns:
    • rxExecuteBlocking

      public <T> Single<T> rxExecuteBlocking(Callable<T> blockingCodeHandler)
      Like executeBlocking(Callable, boolean) called with ordered = true.
      Parameters:
      blockingCodeHandler -
      Returns:
    • newInstance

      public static WorkerExecutor newInstance(WorkerExecutor arg)