Class WorkerExecutor
- All Implemented Interfaces:
MutinyDelegate
,Measured
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWorkerExecutor
(io.vertx.core.WorkerExecutor delegate) WorkerExecutor
(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>
close()
Close the executor.Blocking variant ofclose()
.void
Variant ofclose()
that ignores the result of the operation.boolean
<T> io.smallrye.mutiny.Uni<T>
executeBlocking
(io.smallrye.mutiny.Uni<T> blockingCodeHandler) LikeexecuteBlocking(io.smallrye.mutiny.Uni<T>, boolean)
called with ordered = true.<T> io.smallrye.mutiny.Uni<T>
executeBlocking
(io.smallrye.mutiny.Uni<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.<T> io.smallrye.mutiny.Uni<T>
executeBlocking
(Callable<T> blockingCodeHandler) LikeexecuteBlocking(io.smallrye.mutiny.Uni<T>, boolean)
but using a callback.<T> io.smallrye.mutiny.Uni<T>
executeBlocking
(Callable<T> blockingCodeHandler, boolean ordered) LikeexecuteBlocking(io.smallrye.mutiny.Uni<T>, boolean)
but using a callback.<T> T
executeBlockingAndAwait
(io.smallrye.mutiny.Uni<T> blockingCodeHandler) Deprecated.<T> T
executeBlockingAndAwait
(io.smallrye.mutiny.Uni<T> blockingCodeHandler, boolean ordered) Deprecated.instead useexecuteBlocking(Callable, boolean)
<T> T
executeBlockingAndAwait
(Callable<T> blockingCodeHandler) Blocking variant ofexecuteBlocking(Callable)
.<T> T
executeBlockingAndAwait
(Callable<T> blockingCodeHandler, boolean ordered) Blocking variant ofexecuteBlocking(Callable,boolean)
.<T> void
executeBlockingAndForget
(io.smallrye.mutiny.Uni<T> blockingCodeHandler) Deprecated.instead useexecuteBlocking(Callable)
<T> void
executeBlockingAndForget
(io.smallrye.mutiny.Uni<T> blockingCodeHandler, boolean ordered) Deprecated.instead useexecuteBlocking(Callable, boolean)
<T> void
executeBlockingAndForget
(Callable<T> blockingCodeHandler) Variant ofexecuteBlocking(Callable)
that ignores the result of the operation.<T> void
executeBlockingAndForget
(Callable<T> blockingCodeHandler, boolean ordered) Variant ofexecuteBlocking(Callable,boolean)
that ignores the result of the operation.io.vertx.core.WorkerExecutor
int
hashCode()
boolean
static WorkerExecutor
newInstance
(io.vertx.core.WorkerExecutor arg) toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
WorkerExecutor
public WorkerExecutor(io.vertx.core.WorkerExecutor delegate) -
WorkerExecutor
-
-
Method Details
-
getDelegate
public io.vertx.core.WorkerExecutor getDelegate()- Specified by:
getDelegate
in interfaceMeasured
- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
isMetricsEnabled
public boolean isMetricsEnabled()- Specified by:
isMetricsEnabled
in interfaceMeasured
- Returns:
true
if metrics are enabled
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(io.smallrye.mutiny.Uni<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.
A
Future
instance is passed intoblockingCodeHandler
. When the blocking code successfully completes, the handler should call thePromise.complete(T)
orPromise.complete(T)
method, or thePromise.fail(java.lang.Throwable)
method if it failed.In the
blockingCodeHandler
the current context remains the original context and therefore any task scheduled in theblockingCodeHandler
will be executed on this context and not on the worker thread.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- 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
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeBlockingAndAwait
@Deprecated public <T> T executeBlockingAndAwait(io.smallrye.mutiny.Uni<T> blockingCodeHandler, boolean ordered) Deprecated.instead useexecuteBlocking(Callable, boolean)
Blocking variant ofexecuteBlocking(Consumer,boolean)
.This method waits 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 a RuntimeException).
- 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 T instance produced by the operation.
-
executeBlockingAndForget
@Deprecated public <T> void executeBlockingAndForget(io.smallrye.mutiny.Uni<T> blockingCodeHandler, boolean ordered) Deprecated.instead useexecuteBlocking(Callable, boolean)
Variant ofexecuteBlocking(Consumer,boolean)
that ignores the result of the operation.This method subscribes on the result of
executeBlocking(Consumer,boolean)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecuteBlocking(Consumer,boolean)
but you don't need to compose it with other operations.- 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
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(io.smallrye.mutiny.Uni<T> blockingCodeHandler) LikeexecuteBlocking(io.smallrye.mutiny.Uni<T>, boolean)
called with ordered = true.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
blockingCodeHandler
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeBlockingAndAwait
Deprecated.instead useexecuteBlocking(Callable)
Blocking variant ofexecuteBlocking(Consumer)
.This method waits 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 a RuntimeException).
- Parameters:
blockingCodeHandler
-- Returns:
- the T instance produced by the operation.
-
executeBlockingAndForget
Deprecated.instead useexecuteBlocking(Callable)
Variant ofexecuteBlocking(Consumer)
that ignores the result of the operation.This method subscribes on the result of
executeBlocking(Consumer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecuteBlocking(Consumer)
but you don't need to compose it with other operations.- Parameters:
blockingCodeHandler
-
-
close
Close the executor.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
Blocking variant ofclose()
.This method waits 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 a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget() -
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(Callable<T> blockingCodeHandler) LikeexecuteBlocking(io.smallrye.mutiny.Uni<T>, boolean)
but using a callback.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
blockingCodeHandler
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeBlockingAndAwait
Blocking variant ofexecuteBlocking(Callable)
.This method waits 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 a RuntimeException).
- Parameters:
blockingCodeHandler
-- Returns:
- the T instance produced by the operation.
-
executeBlockingAndForget
Variant ofexecuteBlocking(Callable)
that ignores the result of the operation.This method subscribes on the result of
executeBlocking(Callable)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecuteBlocking(Callable)
but you don't need to compose it with other operations.- Parameters:
blockingCodeHandler
-
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(Callable<T> blockingCodeHandler, boolean ordered) LikeexecuteBlocking(io.smallrye.mutiny.Uni<T>, boolean)
but using a callback.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
blockingCodeHandler
-ordered
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeBlockingAndAwait
Blocking variant ofexecuteBlocking(Callable,boolean)
.This method waits 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 a RuntimeException).
- Parameters:
blockingCodeHandler
-ordered
-- Returns:
- the T instance produced by the operation.
-
executeBlockingAndForget
Variant ofexecuteBlocking(Callable,boolean)
that ignores the result of the operation.This method subscribes on the result of
executeBlocking(Callable,boolean)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecuteBlocking(Callable,boolean)
but you don't need to compose it with other operations.- Parameters:
blockingCodeHandler
-ordered
-
-
newInstance
-
executeBlocking(Callable)