Class WorkerExecutor
- java.lang.Object
-
- io.vertx.rxjava.core.WorkerExecutor
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<WorkerExecutor>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description WorkerExecutor(WorkerExecutor delegate)
WorkerExecutor(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the executor.void
close(Handler<AsyncResult<Void>> handler)
Close the executor.boolean
equals(Object o)
<T> void
executeBlocking(Handler<Promise<T>> blockingCodeHandler)
<T> void
executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)
Safely execute some blocking code.<T> void
executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> resultHandler)
Safely execute some blocking code.<T> void
executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler)
WorkerExecutor
getDelegate()
int
hashCode()
boolean
isMetricsEnabled()
Whether the metrics are enabled for this measured objectstatic WorkerExecutor
newInstance(WorkerExecutor arg)
rx.Single<Void>
rxClose()
Close the executor.<T> rx.Single<T>
rxExecuteBlocking(Handler<Promise<T>> blockingCodeHandler)
<T> rx.Single<T>
rxExecuteBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)
Safely execute some blocking code.String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<WorkerExecutor> __TYPE_ARG
-
-
Constructor Detail
-
WorkerExecutor
public WorkerExecutor(WorkerExecutor delegate)
-
WorkerExecutor
public WorkerExecutor(Object delegate)
-
-
Method Detail
-
getDelegate
public WorkerExecutor getDelegate()
- Specified by:
getDelegate
in interfaceMeasured
-
isMetricsEnabled
public boolean isMetricsEnabled()
Whether the metrics are enabled for this measured object- Specified by:
isMetricsEnabled
in interfaceMeasured
- Returns:
true
if metrics are enabled
-
executeBlocking
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> resultHandler)
Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandler
using a thread from the worker pool.When the code is complete the handler
resultHandler
will be called with the result on the original context (i.e. on the original event loop of the caller).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 the this context and not on the worker thread.- 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 guaranteesresultHandler
- handler that will be called when the blocking code is complete
-
executeBlocking
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)
Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandler
using a thread from the worker pool.When the code is complete the handler
resultHandler
will be called with the result on the original context (i.e. on the original event loop of the caller).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 the this context and not on the worker thread.- 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
-
rxExecuteBlocking
public <T> rx.Single<T> rxExecuteBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered)
Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandler
using a thread from the worker pool.When the code is complete the handler
resultHandler
will be called with the result on the original context (i.e. on the original event loop of the caller).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 the this context and not on the worker thread.- 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:
-
executeBlocking
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler)
LikeexecuteBlocking(io.vertx.core.Handler<io.vertx.rxjava.core.Promise<T>>, boolean, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
called with ordered = true.- Parameters:
blockingCodeHandler
-resultHandler
-
-
executeBlocking
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler)
LikeexecuteBlocking(io.vertx.core.Handler<io.vertx.rxjava.core.Promise<T>>, boolean, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
called with ordered = true.- Parameters:
blockingCodeHandler
-
-
rxExecuteBlocking
public <T> rx.Single<T> rxExecuteBlocking(Handler<Promise<T>> blockingCodeHandler)
LikeexecuteBlocking(io.vertx.core.Handler<io.vertx.rxjava.core.Promise<T>>, boolean, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
called with ordered = true.- Parameters:
blockingCodeHandler
-- 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 rx.Single<Void> rxClose()
Close the executor.- Returns:
-
newInstance
public static WorkerExecutor newInstance(WorkerExecutor arg)
-
-