public interface WorkerExecutor extends Measured
It provides the same executeBlocking
operation than Context
and
Vertx
but on a separate worker pool.
Modifier and Type | Method and Description |
---|---|
Future<Void> |
close()
Like
close(Handler) but returns a Future of the asynchronous result |
void |
close(Handler<AsyncResult<Void>> handler)
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.
|
default <T> void |
executeBlocking(Callable<T> blockingCodeHandler,
boolean ordered,
Handler<AsyncResult<T>> resultHandler)
Like
executeBlocking(Callable, boolean) but using a callback. |
default <T> void |
executeBlocking(Callable<T> blockingCodeHandler,
Handler<AsyncResult<T>> resultHandler)
Like
executeBlocking(Callable) but using a callback. |
default <T> Future<T> |
executeBlocking(Handler<Promise<T>> blockingCodeHandler)
Deprecated.
instead use
executeBlocking(Callable) |
<T> Future<T> |
executeBlocking(Handler<Promise<T>> blockingCodeHandler,
boolean ordered)
Deprecated.
instead use
executeBlocking(Callable, boolean) |
<T> void |
executeBlocking(Handler<Promise<T>> blockingCodeHandler,
boolean ordered,
Handler<AsyncResult<T>> resultHandler)
Deprecated.
instead use
executeBlocking(Callable, boolean) |
default <T> void |
executeBlocking(Handler<Promise<T>> blockingCodeHandler,
Handler<AsyncResult<T>> resultHandler)
Deprecated.
instead use
executeBlocking(Callable) |
isMetricsEnabled
@Deprecated <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> resultHandler)
executeBlocking(Callable, boolean)
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(Object)
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.
T
- the type of the resultblockingCodeHandler
- handler representing the blocking code to runresultHandler
- handler that will be called when the blocking code is completeordered
- 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@Deprecated default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler)
executeBlocking(Callable)
executeBlocking(Handler, boolean, Handler)
called with ordered = true.@Deprecated <T> Future<T> executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)
executeBlocking(Callable, boolean)
executeBlocking(Handler, boolean, Handler)
but with an handler
called when the operation completes<T> Future<T> executeBlocking(Callable<T> blockingCodeHandler, boolean ordered)
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.
T
- the type of the resultblockingCodeHandler
- handler representing the blocking code to runordered
- 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@Deprecated default <T> Future<T> executeBlocking(Handler<Promise<T>> blockingCodeHandler)
executeBlocking(Callable)
executeBlocking(Handler, boolean, Handler)
called with ordered = true.default <T> Future<T> executeBlocking(Callable<T> blockingCodeHandler)
executeBlocking(Callable, boolean)
called with ordered = true.default <T> void executeBlocking(Callable<T> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler)
executeBlocking(Callable)
but using a callback.default <T> void executeBlocking(Callable<T> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> resultHandler)
executeBlocking(Callable, boolean)
but using a callback.void close(Handler<AsyncResult<Void>> handler)
handler
- the completion handlerFuture<Void> close()
close(Handler)
but returns a Future
of the asynchronous resultCopyright © 2024 Eclipse. All rights reserved.