java.lang.Object
io.helidon.service.registry.ServiceRegistryManager
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 Summary
Modifier and TypeMethodDescriptionstatic ServiceRegistryManager
create()
Create a new service registry manager with default configuration.static ServiceRegistryManager
create
(ServiceRegistryConfig config) Create a new service registry manager with custom configuration.registry()
Get (or initialize and get) the service registry managed by this manager.void
shutdown()
Shutdown the managed service registry.static ServiceRegistryManager
start()
Create a new manager with default configuration, and initialize all services that have aService.RunLevel
defined in ascending order (only singletons are initialized).static ServiceRegistryManager
Create a new manager based on the provided binding (usually code generated), and start the service registry services according to the configured run levels.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.static ServiceRegistryManager
start
(ServiceRegistryConfig config) Start the service registry with no generated binding with the provided config.
-
Method Details
-
start
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 theServiceRegistryConfigBlueprint.maxRunLevel()
to 0ServiceRegistryConfigBlueprint.discoverServices()
- honored as configured; as default istrue
, we recommend you set this tofalse
, as all services should be registered explicitly via the generated bindingServiceRegistryConfigBlueprint.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 bindingconfig
- configuration to use (see rules above)- Returns:
- a new registry manager with an initialized registry
-
start
Start the service registry with no generated binding with the provided config. This method honorsServiceRegistryConfigBlueprint.maxRunLevel()
andServiceRegistryConfigBlueprint.runLevels()
to initialize services that fit. In caserunLevels
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
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
Create a new manager with default configuration, and initialize all services that have aService.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
Create a new service registry manager with default configuration.- Returns:
- a new service registry manager
-
create
Create a new service registry manager with custom configuration.- Parameters:
config
- configuration of this registry manager- Returns:
- a new configured service registry manager
-
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.
-