java.lang.Object
io.helidon.service.registry.GlobalServiceRegistry
A global singleton manager for a service registry.
Note that when using this registry, testing is a bit more complicated, as the registry is shared statically.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Whether a service registry instance is configured.static ServiceRegistry
registry()
Current global service registry, will create a new instance if one is not configured.static ServiceRegistry
registry
(ServiceRegistry newGlobalRegistry) Set the current global registry.static ServiceRegistry
registry
(Supplier<ServiceRegistry> registrySupplier) Current global registry if configured, will replace the current global registry with the one provided by supplier if none registered.
-
Method Details
-
configured
public static boolean configured()Whether a service registry instance is configured.- Returns:
true
if a registry instance was already created
-
registry
Current global service registry, will create a new instance if one is not configured.- Returns:
- global service registry
-
registry
Current global registry if configured, will replace the current global registry with the one provided by supplier if none registered.- Parameters:
registrySupplier
- supplier of new global registry if not yet configured- Returns:
- global service registry
-
registry
Set the current global registry. This method always returns the same instance as provided, though the next call toregistry()
may return a different instance if the instance is replaced by another thread.- Parameters:
newGlobalRegistry
- global registry to set- Returns:
- the same instance
-