Class WorkerExecutor
- All Implemented Interfaces:
MutinyDelegate,Measured
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 Mutiny-ified interface.
- Author:
- Julien Viet
- See Also:
-
WorkerExecutor
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.core.metrics.Measured
Measured.MeasuredImpl -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWorkerExecutor(io.vertx.core.WorkerExecutor delegate) Create a new instance ofWorkerExecutordelegating to the given (non-null) instance ofWorkerExecutor.WorkerExecutor(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>close()Close the executor.voidClose the executor.Close the executor.boolean<T> io.smallrye.mutiny.Uni<T>executeBlocking(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.<T> io.smallrye.mutiny.Uni<T>executeBlocking(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.<T> TexecuteBlockingAndAwait(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.<T> TexecuteBlockingAndAwait(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.<T> WorkerExecutorexecuteBlockingAndForget(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.<T> WorkerExecutorexecuteBlockingAndForget(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.io.vertx.core.WorkerExecutorGet the delegate instance.inthashCode()booleanWhether the metrics are enabled for this measured objectstatic WorkerExecutornewInstance(io.vertx.core.WorkerExecutor delegate) Creates a new instance of theWorkerExecutor.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
WorkerExecutor
public WorkerExecutor(io.vertx.core.WorkerExecutor delegate) Create a new instance ofWorkerExecutordelegating to the given (non-null) instance ofWorkerExecutor. -
WorkerExecutor
-
-
Method Details
-
getDelegate
public io.vertx.core.WorkerExecutor getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMeasured- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandlerusing a thread from the worker pool.The returned uni 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
blockingCodeHandlerthe current context remains the original context and therefore any task scheduled in theblockingCodeHandlerwill be executed on this context and not on the worker thread.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Type Parameters:
T- the type of the result- Parameters:
blockingCodeHandler- 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- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
WorkerExecutor.executeBlocking(Callable, boolean)
-
executeBlockingAndAwait
Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandlerusing a thread from the worker pool.The returned underlying uni 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
blockingCodeHandlerthe current context remains the original context and therefore any task scheduled in theblockingCodeHandlerwill be executed on this context and not on the worker thread.Unlike the bare Vert.x variant, this method returns a
WorkerExecutor. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Type Parameters:
T- the type of the result- Parameters:
blockingCodeHandler- 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- Returns:
- The operation result
- See Also:
-
WorkerExecutor.executeBlocking(Callable, boolean)
-
executeBlockingAndForget
public <T> WorkerExecutor executeBlockingAndForget(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandlerusing a thread from the worker pool.The returned underlying uni 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
blockingCodeHandlerthe current context remains the original context and therefore any task scheduled in theblockingCodeHandlerwill be executed on this context and not on the worker thread.Unlike the bare Vert.x variant, this method ignores the
WorkerExecutorresult or any failure.- Type Parameters:
T- the type of the result- Parameters:
blockingCodeHandler- 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- Returns:
- The current instance to chain operations if needed.
- See Also:
-
WorkerExecutor.executeBlocking(Callable, boolean)
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
WorkerExecutor.executeBlocking(Callable)
-
executeBlockingAndAwait
LikeexecuteBlocking(Callable, boolean)called with ordered = true.Unlike the bare Vert.x variant, this method returns a
WorkerExecutor. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Returns:
- The operation result
- See Also:
-
WorkerExecutor.executeBlocking(Callable)
-
executeBlockingAndForget
LikeexecuteBlocking(Callable, boolean)called with ordered = true.Unlike the bare Vert.x variant, this method ignores the
WorkerExecutorresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
WorkerExecutor.executeBlocking(Callable)
-
close
Close the executor.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
WorkerExecutor.close()
-
closeAndAwait
public void closeAndAwait()Close the executor.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
WorkerExecutor.close()
-
closeAndForget
Close the executor.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
WorkerExecutor.close()
-
isMetricsEnabled
public boolean isMetricsEnabled()Whether the metrics are enabled for this measured object- Specified by:
isMetricsEnabledin interfaceMeasured- Returns:
trueif metrics are enabled
-
newInstance
Creates a new instance of theWorkerExecutor. -
hashCode
public int hashCode() -
equals
-
toString
-