Interface VertxManager

All Superinterfaces:
AutoCloseable

public interface VertxManager extends 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 Type
    Method
    Description
    void
    Releases the Vertx instance obtained from vertx().
    get()
    Returns the VertxManager instance.
    default int
    Returns the priority of this manager.
    io.vertx.core.Vertx
    Returns the shared Vertx instance, creating it if necessary.
  • Method Details

    • vertx

      io.vertx.core.Vertx vertx()
      Returns the shared Vertx instance, creating it if necessary.

      Each call to vertx() must have a corresponding call to close().

      Returns:
      the shared Vert.x instance
    • close

      void close()
      Releases the Vertx instance obtained from vertx().

      The Vertx instance 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:
      close in interface AutoCloseable
    • priority

      default int priority()
      Returns the priority of this manager. Lower values indicate higher priority. The default priority is 1000.
      Returns:
      the priority value
    • get

      static VertxManager get()
      Returns the VertxManager instance.
      Returns:
      the manager instance