Top Fields Constructors Methods
io.vertx.core.impl

pack-priv Class WorkerExecutorImpl

extends Object
implements MetricsProvider, WorkerExecutorInternal
Class Inheritance
All Implemented Interfaces
io.vertx.core.impl.WorkerExecutorInternal, io.vertx.core.Closeable, io.vertx.core.WorkerExecutor, io.vertx.core.metrics.Measured, io.vertx.core.spi.metrics.MetricsProvider
Imports
io.vertx.codegen.annotations.Nullable, io.vertx.core.*, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.spi.metrics.Metrics, .MetricsProvider, .PoolMetrics, java.util.concurrent.Callable

Author
Julien Viet

Field Summary

Modifier and TypeField and Description
private boolean
private final CloseFuture
private final VertxImpl.SharedWorkerPool
private final VertxInternal

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Future<Void>
close()

Implements io.vertx.core.WorkerExecutor.close.

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

public void
close(Handler<AsyncResult<Void>>
the completion handler
handler
)

Implements io.vertx.core.WorkerExecutor.close.

Close the executor.

public void
close(Promise<Void>
the promise to signal when close has completed
completion
)

Implements io.vertx.core.Closeable.close.

Close this resource, the completion promise must be notified when the operation has completed.

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

Implements io.vertx.core.WorkerExecutor.executeBlocking.

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

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

Implements io.vertx.core.WorkerExecutor.executeBlocking.

Safely execute some blocking code.

public <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<T>>
handler that will be called when the blocking code is complete
asyncResultHandler
)

Implements io.vertx.core.WorkerExecutor.executeBlocking.

Safely execute some blocking code.

public Metrics
getMetrics()

Implements io.vertx.core.spi.metrics.MetricsProvider.getMetrics.

Returns the metrics implementation.

public WorkerPool
public boolean
isMetricsEnabled()

Overrides default io.vertx.core.metrics.Measured.isMetricsEnabled.

Whether the metrics are enabled for this measured object

public Vertx
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closedback to summary
private boolean closed
closeFutureback to summary
private final CloseFuture closeFuture
poolback to summary
private final VertxImpl.SharedWorkerPool pool
vertxback to summary
private final VertxInternal vertx

Constructor Detail

WorkerExecutorImplback to summary
public WorkerExecutorImpl(VertxInternal vertx, CloseFuture closeFuture, VertxImpl.SharedWorkerPool pool)

Method Detail

closeback to summary
public Future<Void> close()

Implements io.vertx.core.WorkerExecutor.close.

Doc from io.vertx.core.WorkerExecutor.close.

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

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

Implements io.vertx.core.WorkerExecutor.close.

Doc from io.vertx.core.WorkerExecutor.close.

Close the executor.

Parameters
handler:Handler<AsyncResult<Void>>

the completion handler

Annotations
@Override
closeback to summary
public void close(Promise<Void> completion)

Implements io.vertx.core.Closeable.close.

Doc from io.vertx.core.Closeable.close.

Close this resource, the completion promise must be notified when the operation has completed.

Parameters
completion:Promise<Void>

the promise to signal when close has completed

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

Implements io.vertx.core.WorkerExecutor.executeBlocking.

Doc from io.vertx.core.WorkerExecutor.executeBlocking.

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

Annotations
@Override
executeBlockingback to summary
public <T> Future<@Nullable T> executeBlocking(Callable<T> blockingCodeHandler, boolean ordered)

Implements io.vertx.core.WorkerExecutor.executeBlocking.

Doc from io.vertx.core.WorkerExecutor.executeBlocking.

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
@Override
executeBlockingback to summary
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> asyncResultHandler)

Implements io.vertx.core.WorkerExecutor.executeBlocking.

Doc from io.vertx.core.WorkerExecutor.executeBlocking.

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

asyncResultHandler:Handler<AsyncResult<T>>

handler that will be called when the blocking code is complete

getMetricsback to summary
public Metrics getMetrics()

Implements io.vertx.core.spi.metrics.MetricsProvider.getMetrics.

Doc from io.vertx.core.spi.metrics.MetricsProvider.getMetrics.

Returns the metrics implementation.

Returns:Metrics

the metrics

Annotations
@Override
getPoolback to summary
public WorkerPool getPool()

Implements io.vertx.core.impl.WorkerExecutorInternal.getPool.

Annotations
@Override
isMetricsEnabledback to summary
public boolean isMetricsEnabled()

Overrides default io.vertx.core.metrics.Measured.isMetricsEnabled.

Doc from io.vertx.core.metrics.Measured.isMetricsEnabled.

Whether the metrics are enabled for this measured object

Returns:boolean

true if metrics are enabled

Annotations
@Override
vertxback to summary
public Vertx vertx()

Implements io.vertx.core.impl.WorkerExecutorInternal.vertx.

Annotations
@Override