Class WorkerExecutor

  • All Implemented Interfaces:
    Measured

    public class WorkerExecutor
    extends Object
    implements 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.

    • Constructor Detail

      • WorkerExecutor

        public WorkerExecutor​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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
      • executeBlocking

        @Deprecated
        public <T> void executeBlocking​(Handler<Promise<T>> blockingCodeHandler,
                                        boolean ordered,
                                        Handler<AsyncResult<T>> resultHandler)
        Deprecated.
        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.

        A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, the handler should call the Promise.complete(T) or Promise.complete(T) method, or the Promise.fail(java.lang.Throwable) 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 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
      • executeBlocking

        @Deprecated
        public <T> void executeBlocking​(Handler<Promise<T>> blockingCodeHandler,
                                        boolean ordered)
        Deprecated.
        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.

        A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, the handler should call the Promise.complete(T) or Promise.complete(T) method, or the Promise.fail(java.lang.Throwable) 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 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
      • rxExecuteBlocking

        @Deprecated
        public <T> io.reactivex.Maybe<T> rxExecuteBlocking​(Handler<Promise<T>> blockingCodeHandler,
                                                           boolean ordered)
        Deprecated.
        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.

        A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, the handler should call the Promise.complete(T) or Promise.complete(T) method, or the Promise.fail(java.lang.Throwable) 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 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:
      • close

        public void close​(Handler<AsyncResult<Void>> handler)
        Close the executor.
        Parameters:
        handler - the completion handler
      • close

        public void close()
        Close the executor.
      • rxClose

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