Package com.spotify.helios.serviceregistration

Examples of com.spotify.helios.serviceregistration.ServiceRegistrarFactory


   */
  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();
    }
  }
View Full Code Here


  /**
   * Get a registrar factory from a plugin.
   */
  private static ServiceRegistrarFactory createFactory(final Path path) {
    final ServiceRegistrarFactory factory;
    final Path absolutePath = path.toAbsolutePath();
    try {
      factory = ServiceRegistrarLoader.load(absolutePath);
      final String name = factory.getClass().getName();
      log.info("Loaded service registrar plugin: {} ({})", name, absolutePath);
    } catch (ServiceRegistrarLoadingException e) {
      throw new RuntimeException("Unable to load service registrar plugin: " +
                                 absolutePath, e);
    }
View Full Code Here

  /**
   * Get a registrar factory from the application class loader.
   */
  private static ServiceRegistrarFactory createFactory() {
    final ServiceRegistrarFactory factory;
    final ServiceRegistrarFactory installed;
    try {
      installed = ServiceRegistrarLoader.load();
    } catch (ServiceRegistrarLoadingException e) {
      throw new RuntimeException("Unable to load service registrar", e);
    }
View Full Code Here

TOP

Related Classes of com.spotify.helios.serviceregistration.ServiceRegistrarFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.