Class ServiceRegistryManager

java.lang.Object
io.helidon.service.registry.ServiceRegistryManager

public final class ServiceRegistryManager extends Object
Manager is responsible for managing the state of a ServiceRegistry. Each manager instances owns a single service registry.

To use a singleton service across application, either pass it through parameters, or use GlobalServiceRegistry.

  • Method Details

    • start

      public static ServiceRegistryManager start(Binding binding, ServiceRegistryConfig config)
      Create a new manager based on the provided binding (usually code generated), and start the service registry services according to the configured run levels.

      Registers the registry as the GlobalServiceRegistry.

      Configuration options are handled as follows:

      • ServiceRegistryConfigBlueprint.runLevels() - if any run level is configured, it is honored; if no run levels are configured (the default), run levels are updated from generated bindings; to disable any run levels, set the ServiceRegistryConfigBlueprint.maxRunLevel() to 0
      • ServiceRegistryConfigBlueprint.discoverServices() - honored as configured; as default is true, we recommend you set this to false, as all services should be registered explicitly via the generated binding
      • ServiceRegistryConfigBlueprint.serviceDescriptors() - honored, and additional descriptors are added via the generated binding; usually this should not be configured by hand, as there should not be additional descriptors that were not discovered by the plugin that generates build time binding
      • All other configuration options are honored as configured, and not updated
      Parameters:
      binding - generated binding
      config - configuration to use (see rules above)
      Returns:
      a new registry manager with an initialized registry
    • start

      public static ServiceRegistryManager start(ServiceRegistryConfig config)
      Start the service registry with no generated binding with the provided config. This method honors ServiceRegistryConfigBlueprint.maxRunLevel() and ServiceRegistryConfigBlueprint.runLevels() to initialize services that fit. In case runLevels are empty, the registry will initialize all run levels.

      Registers the registry as the GlobalServiceRegistry.

      Parameters:
      config - configuration of the service registry
      Returns:
      a new registry manager with initialized registry
    • start

      public static ServiceRegistryManager start(Binding binding)
      Create a new manager based on the provided binding (usually code generated), and start the service registry services according to the configured run levels.

      Registers the registry as the GlobalServiceRegistry.

      Parameters:
      binding - generated binding
      Returns:
      a new registry manager with an initialized registry
    • start

      public static ServiceRegistryManager start()
      Create a new manager with default configuration, and initialize all services that have a Service.RunLevel defined in ascending order (only singletons are initialized).

      Registers the registry as the GlobalServiceRegistry.

      Returns:
      a new registry manager with an initialized registry
    • create

      public static ServiceRegistryManager create()
      Create a new service registry manager with default configuration.
      Returns:
      a new service registry manager
    • create

      public static ServiceRegistryManager create(ServiceRegistryConfig config)
      Create a new service registry manager with custom configuration.
      Parameters:
      config - configuration of this registry manager
      Returns:
      a new configured service registry manager
    • registry

      public ServiceRegistry registry()
      Get (or initialize and get) the service registry managed by this manager.
      Returns:
      service registry ready to be used
    • shutdown

      public void shutdown()
      Shutdown the managed service registry.