Unlike a normal {@link LoadBalancer.Factory}, this accepts a full service config rather than
the LoadBalancingConfig.

@return null if no selection could be made.
9486
@Nullable
  ConfigOrError selectLoadBalancerPolicy(Map<String, ?> serviceConfig) {
    try {
      List<LbConfig> loadBalancerConfigs = null;
      if (serviceConfig != null) {
        List<Map<String, ?>> rawLbConfigs =
            ServiceConfigUtil.getLoadBalancingConfigsFromServiceConfig(serviceConfig);
        loadBalancerConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(rawLbConfigs);
      }
      if (loadBalancerConfigs != null && !loadBalancerConfigs.isEmpty()) {
        List<String> policiesTried = new ArrayList<>();
        for (LbConfig lbConfig : loadBalancerConfigs) {
          String policy = lbConfig.getPolicyName();
          LoadBalancerProvider provider = registry.getProvider(policy);
          if (provider == null) {
            policiesTried.add(policy);
          } else {
            return ConfigOrError.fromConfig(new PolicySelection(
                provider,
                /* serverList= */ null,
                lbConfig.getRawConfigValue()));
          }
        }
        return ConfigOrError.fromError(
            Status.UNKNOWN.withDescription(
                "None of " + policiesTried + " specified by Service Config are available."));
      }
      return null;
    } catch (RuntimeException e) {
      return ConfigOrError.fromError(
          Status.UNKNOWN.withDescription("can't parse load balancer configuration").withCause(e));
    }
  }
1228421
@SuppressWarnings("unchecked")
  public ServiceT getService() {
    if (service == null) {
      service = serviceFactory.create((OptionsT) this);
    }
    return service;
  }
629924
@Override
  public Configuration getMainConfiguration() {

    return Tang.Factory.getTang().newConfigurationBuilder()
            .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
            .bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstructor.class)
            .build();
  }
337385
public function getConfigurationFactory()
    {
        if (null === $this->configurationFactory) {
            $this->configurationFactory = new Configuration\ConfigurationFactory();
        }

        return $this->configurationFactory;
    }
451201
public BindingFactory getBindingFactory() {
		if (bindingFactory == null) {
			bindingFactory = getApplicationConfig().bindingFactoryProvider().getBindingFactory(formModel);
		}
		return bindingFactory;
	}
478731
public java.util.List<Integer> getLoadBalancerPorts() {
        if (loadBalancerPorts == null) {
            loadBalancerPorts = new com.amazonaws.internal.SdkInternalList<Integer>();
        }
        return loadBalancerPorts;
    }
265949
@EachBean(ServiceHttpClientConfiguration.class)
    @Requires(condition = ServiceHttpClientCondition.class)
    StaticServiceInstanceList serviceInstanceList(ServiceHttpClientConfiguration configuration) {
        List<URI> originalURLs = configuration.getUrls();
        Collection<URI> loadBalancedURIs = new ConcurrentLinkedQueue<>(originalURLs);
        return new StaticServiceInstanceList(configuration.getServiceId(), loadBalancedURIs);
    }
1033466
public ServiceRRLoadBalancer getServiceRRLoadBalancer(String serviceName) {
        for (ServiceRRLoadBalancer lb : svcLBList) {
            if (lb.getServiceName().equals(serviceName)) {
                return lb;
            }
        }
        ServiceRRLoadBalancer lb = new ServiceRRLoadBalancer(lookupService,
                serviceName);
        svcLBList.add(lb);
        return lb;
    }
808434
public static <T> PluggableProviderService<T> getPluginProviderService(
        Class<T> serviceType,
        String serviceName,
        ServiceProviderLoader loader
    )
    {
        for (PluginProviderServices pluginProviderServices : pluginProviderServiceLoader) {
            if (pluginProviderServices.hasServiceFor(serviceType, serviceName)) {
                return pluginProviderServices.getServiceProviderFor(serviceType, serviceName, loader);
            }
        }
        return null;
    }
1245580
private function getRequestFactory()
    {
        if ($requestFactory = $this->app->config->get('swap.request_factory')) {
            return $this->app[$requestFactory];
        }

        return null;
    }
1016028
protected function getConfigHandler()
    {
        if (null !== $typeInfo = ServiceManager::getServiceType($this->type)) {
            // lookup related service type config model
            return $typeInfo->getConfigHandler();
        }

        return null;
    }
428778
public static <T extends Request<T>> RequestAllocator<T> inferFromConfig(RequestAllocatorConfig<T> configuration) {
    try {
      String alias = configuration.getLimitedScopeConfig().hasPath(ALLOCATOR_ALIAS_KEY) ?
          configuration.getLimitedScopeConfig().getString(ALLOCATOR_ALIAS_KEY) :
          BruteForceAllocator.Factory.class.getName();
      RequestAllocator.Factory allocatorFactory = new ClassAliasResolver<>(RequestAllocator.Factory.class).
          resolveClass(alias).newInstance();

      log.info("Using allocator factory " + allocatorFactory.getClass().getName());

      return allocatorFactory.createRequestAllocator(configuration);
    } catch (ReflectiveOperationException roe) {
      throw new RuntimeException(roe);
    }
  }
1086802
public ConstraintValidatorFactory getConstraintValidatorFactoryOverride(Configuration<?> config) {
        ValidationReleasable<ConstraintValidatorFactory> releasable = null;

        String cvfClassName = config.getBootstrapConfiguration().getConstraintValidatorFactoryClassName();
        // If the validation.xml ConstraintValidatorFactory is null AND the CDI feature is enabled
        // we can try to create our own implementation of it.
        if (cvfClassName == null && releasableFactory != null) {
            releasable = releasableFactory.createConstraintValidatorFactory();
        }

        if (releasable != null) {
            if (releasables == null) {
                releasables = new LinkedList<ValidationReleasable<?>>();
            }

            releasables.add(releasable);
            return releasable.getInstance();
        }
        return null;
    }
660845
synchronized static void setFactoryImplementation() {
        if (initialized)
            return;
        initialized = true;
        String authConfigProvider = Security.getProperty(AuthConfigFactory.DEFAULT_FACTORY_SECURITY_PROPERTY);
        if (authConfigProvider == null || authConfigProvider.isEmpty()) {
            Tr.info(tc, "JASPI_DEFAULT_AUTH_CONFIG_FACTORY", new Object[] { JASPI_PROVIDER_REGISTRY });
            Security.setProperty(AuthConfigFactory.DEFAULT_FACTORY_SECURITY_PROPERTY, JASPI_PROVIDER_REGISTRY);
        } else if (!authConfigProvider.equals(JASPI_PROVIDER_REGISTRY)) {
            Tr.info(tc, "JASPI_AUTH_CONFIG_FACTORY", new Object[] { authConfigProvider });
        }
    }
12218
public java.util.List<String> getLoadBalancerNames() {
        if (loadBalancerNames == null) {
            loadBalancerNames = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return loadBalancerNames;
    }
1239406
@EachBean(ServiceHttpClientConfiguration.class)
    @Requires(condition = ServiceHttpClientCondition.class)
    DefaultHttpClient serviceHttpClient(
            @Parameter ServiceHttpClientConfiguration configuration,
            @Parameter StaticServiceInstanceList instanceList) {
        List<URI> originalURLs = configuration.getUrls();
        Collection<URI> loadBalancedURIs = instanceList.getLoadBalancedURIs();
        boolean isHealthCheck = configuration.isHealthCheck();

        LoadBalancer loadBalancer = loadBalancerFactory.create(instanceList);

        Optional<String> path = configuration.getPath();
        DefaultHttpClient httpClient;
        if (path.isPresent()) {
            httpClient = beanContext.createBean(DefaultHttpClient.class, loadBalancer, configuration, path.get());
        } else {
            httpClient = beanContext.createBean(DefaultHttpClient.class, loadBalancer, configuration);
        }

        httpClient.setClientIdentifiers(configuration.getServiceId());

        if (isHealthCheck) {
            taskScheduler.scheduleWithFixedDelay(configuration.getHealthCheckInterval(), configuration.getHealthCheckInterval(), () -> Flowable.fromIterable(originalURLs).flatMap(originalURI -> {
                URI healthCheckURI = originalURI.resolve(configuration.getHealthCheckUri());
                return httpClient.exchange(HttpRequest.GET(healthCheckURI)).onErrorResumeNext(throwable -> {
                    if (throwable instanceof HttpClientResponseException) {
                        HttpClientResponseException responseException = (HttpClientResponseException) throwable;
                        HttpResponse response = responseException.getResponse();
                        //noinspection unchecked
                        return Flowable.just(response);
                    }
                    return Flowable.just(HttpResponse.serverError());
                }).map(response -> Collections.singletonMap(originalURI, response.getStatus()));
            }).subscribe(uriToStatusMap -> {
                Map.Entry<URI, HttpStatus> entry = uriToStatusMap.entrySet().iterator().next();

                URI uri = entry.getKey();
                HttpStatus status = entry.getValue();

                if (status.getCode() >= 300) {
                    loadBalancedURIs.remove(uri);
                } else if (!loadBalancedURIs.contains(uri)) {
                    loadBalancedURIs.add(uri);
                }
            }));
        }
        return httpClient;
    }
830012
public function getConfigsFactory() {
		if ($this->_configsFactory === null) {
			if ($this instanceof LocatorAwareInterface && $this->hasLocator()) {
				$this->_configsFactory = $this->getLocator()->get('configsFactory');
				
				if (! $this->_configsFactory instanceof FactoryInterface) {
					throw new NoConfigsFactory('Configs\' factory must implement the "FactoryInterface"');
				}
			} else {
				throw new NoConfigsFactory('No configs\' factory been supplied, also unable to obtain one through locator');
			}
		}
		
		return $this->_configsFactory;
	}