Top Description Methods
io.vertx.core

public Interface WorkerExecutor

extends Measured
Known Direct Subinterfaces
io.vertx.core.impl.WorkerExecutorInternal
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.GenIgnore, .Nullable, .VertxGen, io.vertx.core.metrics.Measured, java.util.concurrent.Callable

An executor for executing blocking code in Vert.x .

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

Author
Julien Viet

Method Summary

Modifier and TypeMethod and Description
public void
close(Handler<AsyncResult<Void>>
the completion handler
handler
)

Close the executor.

public Future<Void>
close()

Like close(Handler) but returns a Future of the asynchronous result

public <
the type of the result
T
>
void
executeBlocking(Handler<Promise<T>>
handler representing the blocking code to run
blockingCodeHandler
,
boolean
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
ordered
,
Handler<AsyncResult<@Nullable T>>
handler that will be called when the blocking code is complete
resultHandler
)
Deprecated instead use executeBlocking(Callable, boolean)

Safely execute some blocking code.

public default <T> void
executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler)
Deprecated instead use executeBlocking(Callable)

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

public <T> Future<@Nullable T>
executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)
Deprecated instead use executeBlocking(Callable, boolean)

Same as executeBlocking(Handler, boolean, Handler) but with an handler called when the operation completes

public <
the type of the result
T
>
Future<@Nullable T>

Returns:

a future notified with the result
executeBlocking
(Callable<T>
handler representing the blocking code to run
blockingCodeHandler
,
boolean
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
ordered
)

Safely execute some blocking code.

public default <T> Future<T>
executeBlocking(Handler<Promise<T>> blockingCodeHandler)
Deprecated instead use executeBlocking(Callable)

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

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

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

public default <T> void
executeBlocking(Callable<T> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler)

Like executeBlocking(Callable) but using a callback.

public default <T> void
executeBlocking(Callable<T> blockingCodeHandler, boolean ordered, Handler<AsyncResult<@Nullable T>> resultHandler)

Like executeBlocking(Callable, boolean) but using a callback.

Inherited from io.vertx.core.metrics.Measured:
isMetricsEnabled

Method Detail

closeback to summary
public void close(Handler<AsyncResult<Void>> handler)

Close the executor.

Parameters
handler:Handler<AsyncResult<Void>>

the completion handler

closeback to summary
public Future<Void> close()

Like close(Handler) but returns a Future of the asynchronous result

executeBlockingback to summary
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<@Nullable T>> resultHandler)

Deprecated

instead use executeBlocking(Callable, boolean)

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 or Promise#complete(Object) method, or the Promise#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 this context and not on the worker thread.

Parameters
<T>
the type of the result
blockingCodeHandler:Handler<Promise<T>>

handler representing the blocking code to run

ordered:boolean

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<AsyncResult<@Nullable T>>

handler that will be called when the blocking code is complete

Annotations
@Deprecated
executeBlockingback to summary
public default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler)

Deprecated

instead use executeBlocking(Callable)

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

Annotations
@Deprecated
executeBlockingback to summary
public <T> Future<@Nullable T> executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)

Deprecated

instead use executeBlocking(Callable, boolean)

Same as executeBlocking(Handler, boolean, Handler) but with an handler called when the operation completes

Annotations
@Deprecated
executeBlockingback to summary
public <T> Future<@Nullable 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
<T>
the type of the result
blockingCodeHandler:Callable<T>

handler representing the blocking code to run

ordered:boolean

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:Future<@Nullable T>

a future notified with the result

Annotations
@GenIgnore:permitted-type
executeBlockingback to summary
public default <T> Future<T> executeBlocking(Handler<Promise<T>> blockingCodeHandler)

Deprecated

instead use executeBlocking(Callable)

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

Annotations
@Deprecated
executeBlockingback to summary
public default <T> Future<T> executeBlocking(Callable<T> blockingCodeHandler)

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

Annotations
@GenIgnore:permitted-type
executeBlockingback to summary
public default <T> void executeBlocking(Callable<T> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler)

Like executeBlocking(Callable) but using a callback.

Annotations
@GenIgnore:permitted-type
executeBlockingback to summary
public default <T> void executeBlocking(Callable<T> blockingCodeHandler, boolean ordered, Handler<AsyncResult<@Nullable T>> resultHandler)

Like executeBlocking(Callable, boolean) but using a callback.

Annotations
@GenIgnore:permitted-type