Interface VertxManager
- All Superinterfaces:
AutoCloseable
Manages a shared
Vertx instance across consumers within the same JVM.
Each consumer calls vertx() to obtain the Vertx instance and close() when finished.
The Vertx instance is created lazily on the first vertx() and shut down once all consumers
have closed.
Implementations are discovered via ServiceLoader. If no implementation is found, a
default implementation is used which creates the Vertx instance via a
VertxFactory.
- Author:
- James R. Perkins
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases theVertxinstance obtained fromvertx().static VertxManagerget()Returns theVertxManagerinstance.default intpriority()Returns the priority of this manager.io.vertx.core.Vertxvertx()Returns the sharedVertxinstance, creating it if necessary.
-
Method Details
-
vertx
io.vertx.core.Vertx vertx()Returns the sharedVertxinstance, creating it if necessary.Each call to
vertx()must have a corresponding call toclose().- Returns:
- the shared Vert.x instance
-
close
void close()Releases theVertxinstance obtained fromvertx().The
Vertxinstance is shut down once all consumers have closed. If other consumers are still using the instance, this method has no effect on the instance itself.- Specified by:
closein interfaceAutoCloseable
-
priority
default int priority()Returns the priority of this manager. Lower values indicate higher priority. The default priority is1000.- Returns:
- the priority value
-
get
-