Class GlobalServiceRegistry

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

public final class GlobalServiceRegistry extends Object
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 Details

    • configured

      public static boolean configured()
      Whether a service registry instance is configured.
      Returns:
      true if a registry instance was already created
    • registry

      public static ServiceRegistry registry()
      Current global service registry, will create a new instance if one is not configured.
      Returns:
      global service registry
    • registry

      public 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.
      Parameters:
      registrySupplier - supplier of new global registry if not yet configured
      Returns:
      global service registry
    • registry

      public static ServiceRegistry registry(ServiceRegistry newGlobalRegistry)
      Set the current global registry. This method always returns the same instance as provided, though the next call to registry() may return a different instance if the instance is replaced by another thread.
      Parameters:
      newGlobalRegistry - global registry to set
      Returns:
      the same instance