Top Inners Fields Constructors Methods
io.vertx.core.impl

public Class VertxImpl

extends Object
implements VertxInternal, MetricsProvider
Class Inheritance
All Implemented Interfaces
io.vertx.core.spi.metrics.MetricsProvider, io.vertx.core.metrics.Measured, io.vertx.core.impl.VertxInternal, io.vertx.core.Vertx
Imports
io.netty.channel.EventLoop, .EventLoopGroup, io.netty.resolver.AddressResolverGroup, io.netty.util.ResourceLeakDetector, io.netty.util.concurrent.GenericFutureListener, io.vertx.core.Future, io.vertx.core.*, .Timer, io.vertx.core.datagram.DatagramSocket, .DatagramSocketOptions, io.vertx.core.datagram.impl.DatagramSocketImpl, io.vertx.core.dns.AddressResolverOptions, .DnsClient, .DnsClientOptions, io.vertx.core.dns.impl.DnsClientImpl, io.vertx.core.eventbus.EventBus, io.vertx.core.eventbus.impl.EventBusImpl, .EventBusInternal, io.vertx.core.eventbus.impl.clustered.ClusteredEventBus, io.vertx.core.file.FileSystem, io.vertx.core.http.*, io.vertx.core.http.impl.*, .HttpClientImpl, .HttpServerImpl, io.vertx.core.impl.btc.BlockedThreadChecker, io.vertx.core.net.impl.NetClientBuilder, .NetServerImpl, .ServerID, .TCPServerBase, io.vertx.core.impl.transports.JDKTransport, io.vertx.core.spi.context.storage.ContextLocal, io.vertx.core.spi.file.FileResolver, io.vertx.core.file.impl.FileSystemImpl, .WindowsFileSystem, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.impl.logging.Logger, .LoggerFactory, io.vertx.core.impl.resolver.DnsResolverProvider, io.vertx.core.net.NetClient, .NetClientOptions, .NetServer, .NetServerOptions, io.vertx.core.spi.transport.Transport, io.vertx.core.shareddata.SharedData, io.vertx.core.shareddata.impl.SharedDataImpl, io.vertx.core.spi.ExecutorServiceFactory, .VerticleFactory, .VertxThreadFactory, io.vertx.core.spi.cluster.ClusterManager, .NodeSelector, io.vertx.core.spi.metrics.Metrics, .MetricsProvider, .PoolMetrics, .VertxMetrics, io.vertx.core.spi.tracing.VertxTracer, java.io.File, .IOException, java.lang.ref.WeakReference, java.lang.reflect.Method, java.net.InetAddress, .InetSocketAddress, java.util.*, java.util.concurrent.*, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, .AtomicLong, java.util.function.Function, .Supplier

Author
Tim Fox

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv class
VertxImpl.InternalTimerHandler

Timers are stored in the timeouts map at creation time.

pack-priv class
private class
VertxImpl.TimeoutStreamImpl

References Deprecated TimeoutStream is deprecated or references (maybe indirectly) at least one deprecated element.

Field Summary

Modifier and TypeField and Description
private final EventLoopGroup
private final AddressResolver
private final AddressResolverOptions
private final BlockedThreadChecker
private boolean
private final CloseFuture
private static final String
private final ClusterManager
private final ContextLocal<?>[]
private final List<ContextLocal<?>>
private final int
private final DeploymentManager
private final boolean
private final EventBusInternal
private final EventLoopGroup
private final ThreadFactory
private volatile Handler<Throwable>
private final ExecutorServiceFactory
private final FileResolver
private final FileSystem
private volatile HAManager
pack-priv final WorkerPool
private static final Logger
private final long
private final TimeUnit
private final long
private final TimeUnit
private final VertxMetrics
private final Map<String, VertxImpl.SharedWorkerPool>
private static final int
private static final String
private final NodeSelector
pack-priv static final ThreadLocal<VertxImpl.ContextDispatch>
nonVertxContextDispatch

Context dispatch info for context running with non vertx threads (Loom).

private final SharedData
private final Map<ServerID, HttpServerImpl>
private final Map<ServerID, NetServerImpl>
private final ThreadLocal<WeakReference<ContextInternal>>
private final VertxThreadFactory
private final AtomicLong
private final ConcurrentMap<Long, VertxImpl.InternalTimerHandler>
private final VertxTracer<I, O>
private final Transport
private final Boolean
private final VerticleManager
private final ExecutorService
pack-priv final WorkerPool
pack-priv final WorkerPool

Constructor Summary

AccessConstructor and Description
pack-priv
VertxImpl(VertxOptions options, ClusterManager clusterManager, NodeSelector nodeSelector, VertxMetrics metrics, VertxTracer<?, ?> tracer, Transport transport, FileResolver fileResolver, VertxThreadFactory threadFactory, ExecutorServiceFactory executorServiceFactory)

Method Summary

Modifier and TypeMethod and Description
public void
public AddressResolver
pack-priv ContextInternal

Returns:

the current context that shall be restored
beginDispatch
(ContextInternal
the context on which the event is emitted on
context
)

Begin the emission of a context event.

private ContextInternal
public BlockedThreadChecker
public boolean
cancelTimer(long
The id of the timer to cancel
id
)

Implements io.vertx.core.Vertx.cancelTimer.

Cancels the timer with the specified id.

public Future<Void>
close()

Implements io.vertx.core.Vertx.close.

Stop the Vertx instance and release any resources held by it.

public synchronized void
close(Handler<AsyncResult<Void>>
The handler will be notified when the close is complete.
completionHandler
)

Implements io.vertx.core.Vertx.close.

Like close but the completionHandler will be called when the close is complete

private void
public CloseFuture
public List<ContextLocal<?>>
private ContextInternal
private ContextImpl
createContext(ThreadingModel threadingModel, EventLoop eventLoop, CloseFuture closeFuture, Deployment deployment, ClassLoader tccl, EventExecutor eventExecutor, WorkerPool wp)

public DatagramSocket
createDatagramSocket(DatagramSocketOptions
the options to use
options
)

Implements io.vertx.core.Vertx.createDatagramSocket.

Create a datagram socket using the specified options

public DnsClient
createDnsClient(int
the port
port
,
String
the host
host
)

Implements io.vertx.core.Vertx.createDnsClient.

Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds)

public DnsClient
createDnsClient()

Implements io.vertx.core.Vertx.createDnsClient.

Create a DNS client to connect to the DNS server configured by VertxOptions#getAddressResolverOptions()

DNS client takes the first configured resolver address provided by DnsResolverProvider#nameServerAddresses()}

public DnsClient
createDnsClient(DnsClientOptions
the client options
options
)

Implements io.vertx.core.Vertx.createDnsClient.

Create a DNS client to connect to a DNS server

private ContextImpl
createEventLoopContext(EventLoop eventLoop, CloseFuture closeFuture, WorkerPool workerPool, Deployment deployment, ClassLoader tccl)

public ContextImpl
public ContextImpl
public ContextImpl
private void
createHaManager(VertxOptions options, Promise<Void> initPromise)

public HttpClient
createHttpPoolClient(HttpClientOptions
the http client options to use
clientOptions
,
PoolOptions
the pool options to use
poolOptions
,
CloseFuture
the close future
closeFuture
)

Implements io.vertx.core.impl.VertxInternal.createHttpPoolClient.

Create a HTTP/HTTPS client using the specified options and close future

public HttpServer
createHttpServer(HttpServerOptions
the options to use
serverOptions
)

Implements io.vertx.core.Vertx.createHttpServer.

Create an HTTP/HTTPS server using the specified options

public NetClient
createNetClient(NetClientOptions
the options to use
options
)

Implements io.vertx.core.Vertx.createNetClient.

Create a TCP/SSL client using the specified options

public NetServer
createNetServer(NetServerOptions
the options to use
options
)

Implements io.vertx.core.Vertx.createNetServer.

Create a TCP/SSL server using the specified options

public WorkerExecutorImpl
public WorkerExecutorImpl
public synchronized WorkerExecutorImpl
public synchronized WorkerExecutorImpl
createSharedWorkerExecutor(String
the name of the worker executor
name
,
int
the size of the pool
poolSize
,
long
the value of max worker execute time
maxExecuteTime
,
TimeUnit
the value of unit of max worker execute time
maxExecuteTimeUnit
)

Implements io.vertx.core.impl.VertxInternal.createSharedWorkerExecutor.

Create a named worker executor, the executor should be closed when it's not needed anymore to release resources.

public synchronized VertxImpl.SharedWorkerPool
createSharedWorkerPool(String name, int poolSize, long maxExecuteTime, TimeUnit maxExecuteTimeUnit)

Implements io.vertx.core.impl.VertxInternal.createSharedWorkerPool.

private static ThreadFactory
createThreadFactory(VertxThreadFactory threadFactory, BlockedThreadChecker checker, Boolean useDaemonThread, long maxExecuteTime, TimeUnit maxExecuteTimeUnit, String prefix, boolean worker)

private ContextImpl
createVirtualThreadContext(EventLoop eventLoop, CloseFuture closeFuture, Deployment deployment, ClassLoader tccl)

public ContextImpl
public ContextImpl
public ContextImpl
public WebSocketClient
createWebSocketClient(WebSocketClientOptions
the options to use
options
,
CloseFuture
the close future
closeFuture
)

Implements io.vertx.core.impl.VertxInternal.createWebSocketClient.

Create a WebSocket client using the specified options and close future

public WebSocketClient
createWebSocketClient(WebSocketClientOptions
the options to use
options
)

Implements io.vertx.core.Vertx.createWebSocketClient.

Create a WebSocket client using the specified options

private ContextImpl
createWorkerContext(EventLoop eventLoop, CloseFuture closeFuture, WorkerPool workerPool, Deployment deployment, ClassLoader tccl)

public ContextInternal
public ContextImpl
public ContextImpl
public static ContextInternal

Returns:

the current context
currentContext
(Thread thread)

private void
public Set<String>
deploymentIDs()

Implements io.vertx.core.Vertx.deploymentIDs.

Return a Set of deployment IDs for the currently deployed deploymentIDs.

public Future<String>
deployVerticle(String
the name
name
,
DeploymentOptions
the deployment options.
options
)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle) but io.vertx.core.DeploymentOptions are provided to configure the deployment.

public void
deployVerticle(String
the name
name
,
DeploymentOptions
the deployment options.
options
,
Handler<AsyncResult<String>>
a handler which will be notified when the deployment is complete
completionHandler
)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(String, Handler) but io.vertx.core.DeploymentOptions are provided to configure the deployment.

public void
deployVerticle(Verticle
the verticle instance to deploy
verticle
,
Handler<AsyncResult<String>>
a handler which will be notified when the deployment is complete
completionHandler
)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle) but the completionHandler will be notified when the deployment is complete.

public Future<String>
deployVerticle(Verticle
the verticle instance to deploy
verticle
,
DeploymentOptions
the deployment options.
options
)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle) but io.vertx.core.DeploymentOptions are provided to configure the deployment.

public void
deployVerticle(Verticle
the verticle instance to deploy
verticle
,
DeploymentOptions
the deployment options.
options
,
Handler<AsyncResult<String>>
a handler which will be notified when the deployment is complete
completionHandler
)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle, Handler) but io.vertx.core.DeploymentOptions are provided to configure the deployment.

public Future<String>
deployVerticle(Class<? extends Verticle> verticleClass, DeploymentOptions options)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle, DeploymentOptions) but Verticle instance is created by invoking the default constructor of verticleClass.

public void
deployVerticle(Class<? extends Verticle> verticleClass, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle, DeploymentOptions, Handler) but Verticle instance is created by invoking the default constructor of verticleClass.

public Future<String>
deployVerticle(Supplier<Verticle> verticleSupplier, DeploymentOptions options)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle, DeploymentOptions) but Verticle instance is created by invoking the verticleSupplier.

public void
deployVerticle(Supplier<Verticle> verticleSupplier, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler)

Implements io.vertx.core.Vertx.deployVerticle.

Like deployVerticle(Verticle, DeploymentOptions, Handler) but Verticle instance is created by invoking the verticleSupplier.

private Future<String>
deployVerticle(Callable<Verticle> verticleSupplier, DeploymentOptions options)

pack-priv void
pack-priv void
endDispatch(ContextInternal
the previous context thread to restore, might be null
prev
)

End the emission of a context task.

private void
public EventBus
eventBus()

Implements io.vertx.core.Vertx.eventBus.

Get the event bus object.

public Vertx
public Handler<Throwable>
pack-priv void
executeIsolated(Handler<Void>
the task to execute
task
)

Execute the task disabling the thread-local association for the duration of the execution.

public void
public synchronized void
public FileResolver
public FileSystem
fileSystem()

Implements io.vertx.core.Vertx.fileSystem.

Get the filesystem object.

public EventLoopGroup
public ClusterManager
public ContextInternal
getContext()

Implements io.vertx.core.impl.VertxInternal.getContext.

Get the current context

private ContextInternal
getContext(Thread current)

public Deployment
public EventLoopGroup
protected FileSystem

Returns:

The FileSystem implementation for the OS
getFileSystem
()

public WorkerPool
public Metrics
getMetrics()

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

Returns the metrics implementation.

public ContextInternal
getOrCreateContext()

Implements io.vertx.core.impl.VertxInternal.getOrCreateContext.

Gets the current context, or creates one if there isn't one

private ContextInternal
public WorkerPool
public HAManager
public HttpClientBuilder
httpClientBuilder()

Implements io.vertx.core.Vertx.httpClientBuilder.

Provide a builder for HttpClient, it can be used to configure advanced HTTP client settings like a redirect handler or a connection handler.

pack-priv void
init()

pack-priv void
private void
public boolean
isClustered()

Implements io.vertx.core.Vertx.isClustered.

Is this Vert.x instance clustered?

public boolean
public boolean
isMetricsEnabled()

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

Whether the metrics are enabled for this measured object

public boolean
public boolean
public long
public TimeUnit
public VertxMetrics
public AddressResolverGroup<InetSocketAddress>
public EventLoopGroup
nettyEventLoopGroup()

Implements io.vertx.core.Vertx.nettyEventLoopGroup.

Return the Netty EventLoopGroup used by Vert.x

public TimeoutStream
periodicStream(long
the initial delay in milliseconds
initialDelay
,
long
the delay in milliseconds, after which the timer will fire
delay
)

Implements io.vertx.core.Vertx.periodicStream.

References Deprecated TimeoutStream is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a periodic timer as a read stream.

public <T> PromiseInternal<T>
public <T> PromiseInternal<T>
public void
registerVerticleFactory(VerticleFactory
the factory to register
factory
)

Implements io.vertx.core.Vertx.registerVerticleFactory.

Register a VerticleFactory that can be used for deploying Verticles based on an identifier.

public void
public void
resolveAddress(String
the hostname to resolve
hostname
,
Handler<AsyncResult<InetAddress>>
the result handler
resultHandler
)

Implements io.vertx.core.impl.VertxInternal.resolveAddress.

Resolve an address (e.g. vertx.io into the first found A (IPv4) or AAAA (IPv6) record.

private CloseFuture
public File
public void
runOnContext(Handler<Void>
- a handler representing the action to execute
task
)

Implements io.vertx.core.Vertx.runOnContext.

Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all preceeding events have been handled.

private long
scheduleTimeout(ContextInternal context, boolean periodic, long initialDelay, long delay, TimeUnit timeUnit, boolean addCloseHook, Handler<Long> handler)

public long
scheduleTimeout(ContextInternal context, boolean periodic, long delay, TimeUnit timeUnit, boolean addCloseHook, Handler<Long> handler)

public long
setPeriodic(long
the initial delay in milliseconds
initialDelay
,
long
the delay in milliseconds, after which the timer will fire
delay
,
Handler<Long>
the handler that will be called with the timer ID when the timer fires
handler
)

Implements io.vertx.core.Vertx.setPeriodic.

Set a periodic timer to fire every delay milliseconds with initial delay, at which point handler will be called with the id of the timer.

public long
setTimer(long
the delay in milliseconds, after which the timer will fire
delay
,
Handler<Long>
the handler that will be called with the timer ID when the timer fires
handler
)

Implements io.vertx.core.Vertx.setTimer.

Set a one-shot timer to fire after delay milliseconds, at which point handler will be called with the id of the timer.

public SharedData
sharedData()

Implements io.vertx.core.Vertx.sharedData.

Get the shared data object.

public Map<ServerID, HttpServerImpl>
public Map<ServerID, NetServerImpl>
public <S extends TCPServerBase> Map<ServerID, S>
public void
private void
startEventBus(boolean haEnabled, Promise<Void> initPromise)

public Timer
timer(long
the delay
delay
,
TimeUnit
the delay unit
unit
)

Implements io.vertx.core.Vertx.timer.

Create a timer task configured with the specified delay, when the timeout fires the timer future is succeeded, when the timeout is cancelled the timer future is failed with a java.util.concurrent.CancellationException instance.

public TimeoutStream
timerStream(long
the delay in milliseconds, after which the timer will fire
delay
)

Implements io.vertx.core.Vertx.timerStream.

References Deprecated TimeoutStream is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a one-shot timer as a read stream.

public VertxTracer<I, O>
public Transport
public Throwable
public Future<Void>
undeploy(String
the deployment ID
deploymentID
)

Implements io.vertx.core.Vertx.undeploy.

Undeploy a verticle deployment.

public void
undeploy(String
the deployment ID
deploymentID
,
Handler<AsyncResult<Void>>
a handler which will be notified when the undeployment is complete
completionHandler
)

Implements io.vertx.core.Vertx.undeploy.

Like undeploy(String) but the completionHandler will be notified when the undeployment is complete.

public void
unregisterVerticleFactory(VerticleFactory
the factory to unregister
factory
)

Implements io.vertx.core.Vertx.unregisterVerticleFactory.

Unregister a VerticleFactory

public Set<VerticleFactory>
verticleFactories()

Implements io.vertx.core.Vertx.verticleFactories.

Return the Set of currently registered verticle factories.

private static ThreadFactory
public WorkerPool
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait