Class DefaultVertxInstance
The Vertx instance is created via explicit lazy initialization (not a static initializer or class-holder pattern) to ensure compatibility with GraalVM native image builds. Static initializers that create Vertx/Netty objects would cause build-time heap serialization failures.
Warning: Using the default Vertx instance is not recommended for
production use. Applications should manage their own Vertx instance and provide it
via RegistryClientOptions.vertx(Vertx) to ensure proper lifecycle management
and resource cleanup.
-
Method Summary
-
Method Details
-
get
public static io.vertx.core.Vertx get()Returns the shared default Vertx instance, creating it lazily on first access.Warning: This default instance is shared across all clients and may not be properly closed. It is recommended to provide your own Vertx instance via
RegistryClientOptions.vertx(Vertx).- Returns:
- the shared Vertx instance
- Throws:
IllegalStateException- if the instance has been closed
-
close
public static void close()Closes the default Vertx instance if it has been initialized. This method should be called during application shutdown to properly release resources.This method is idempotent - calling it multiple times has no effect after the first call.
Note: After calling this method, subsequent calls to
get()will throw anIllegalStateException.
-