code: public static ServiceRegistrar createServiceRegistrar(final Path path,
                                                          final String address,
                                                          final String domain) {
      // Get a registrar factory
      final ServiceRegistrarFactory factory;
      if (path == null) {
        factory = createFactory();
      } else {
        factory = createFactory(path);
      }
  
      // Create the registrar
      if (address != null) {
        log.info("Creating service registrar with address: {}", address);
        return factory.create(address);
      } else if (!Strings.isNullOrEmpty(domain)) {
        log.info("Creating service registrar for domain: {}", domain);
  
        // TODO: localhost:4999 is pretty specific to Spotify's registrar, this should be
        // handled in createForDomain there, rather than here.  Localhost should just pass through.
        return domain.equals("localhost")
               ? factory.create("tcp://localhost:4999")
               : factory.createForDomain(domain);
      } else {
        log.info("No address nor domain configured, not creating service registrar.");
        return new NopServiceRegistrar();
      }
    }
docs: Create a registrar. Attempts to load it from a plugin if path is not null or using the app
  class loader otherwise. If no registrar plugin was found, returns a nop registrar.
  
  @param path    Path to plugin jar.
  @param address The address of the registry the registrar should connect to.
  @param domain  The domain that the registry should be managing.
  
  @return The ServiceRegistrar object.