Infer and construct a {@link RequestAllocator} from an input {@link Config}.
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);
    }
  }
579692
private RequestMetricCollector findRequestMetricCollector(RequestConfig requestConfig) {
        RequestMetricCollector reqLevelMetricsCollector = requestConfig
                .getRequestMetricsCollector();
        if (reqLevelMetricsCollector != null) {
            return reqLevelMetricsCollector;
        } else if (clientLevelMetricCollector != null) {
            return clientLevelMetricCollector;
        } else {
            return AwsSdkMetrics.getRequestMetricCollector();
        }
    }
982776
@CheckReturnValue
  public <NewReqT, NewRespT> Builder<NewReqT, NewRespT> toBuilder(
      Marshaller<NewReqT> requestMarshaller, Marshaller<NewRespT> responseMarshaller) {
    return MethodDescriptor.<NewReqT, NewRespT>newBuilder()
        .setRequestMarshaller(requestMarshaller)
        .setResponseMarshaller(responseMarshaller)
        .setType(type)
        .setFullMethodName(fullMethodName)
        .setIdempotent(idempotent)
        .setSafe(safe)
        .setSampledToLocalTracing(sampledToLocalTracing)
        .setSchemaDescriptor(schemaDescriptor);
  }
155642
protected RequestParser<T> createRequestParser()
    {
        //get parser configuration
        String configurationKey=this.getRequestParserConfigurationKey();
        String defaultParserClassName=this.getDefaultParserClassName();
        
        //create parser
        RequestParser<T> parser=this.createRequestParser(configurationKey,defaultParserClassName);
        
        return parser;
    }
334312
private RequestConfig createDefaultRequestConfig(HttpSettings settings) {
        int connectionTimeout = settings.getConnectionTimeout();
        int socketTimeout = settings.getReadTimeout();
        return RequestConfig.custom().setConnectionRequestTimeout(connectionTimeout).setSocketTimeout(socketTimeout).build();
    }
114966
public Reader create(Reader input, String configuration, String defaultConfiguration) throws IOException {
    if(defaultConfiguration==null) {
      defaultConfiguration = defaultArgument;
    }
    if (configs != null && configs.size() > 0) {
      if (configuration == null && defaultConfiguration == null) {
        throw new IOException("no (default)configuration");
      } else if (configuration == null) {
        if (configs.get(defaultConfiguration) != null) {
          return create(input, configs.get(defaultConfiguration));
        } else {
          throw new IOException(
              "default configuration " + defaultConfiguration + " not available");
        }
      } else {
        MtasConfiguration config = configs.get(configuration);
        if (config == null) {
          if (defaultConfiguration != null) {
            if (configs.get(defaultConfiguration) != null) {
              return create(input, configs.get(defaultConfiguration));
            } else {
              throw new IOException("configuration " + configuration
                  + " not found and default configuration " + defaultConfiguration
                  + " not available");
            }
          } else {
            throw new IOException("configuration " + configuration
                + " not available and no default configuration");
          }
        } else {
          return create(input, config);
        }
      }
    } else if (config != null) {
      return create(input, config);
    } else {
      throw new IOException("no configuration");
    }

  }
497126
public static SimonConsoleRequestProcessor create(String urlPrefix, Manager manager, String pluginClasses) {
		SimonConsoleRequestProcessor requestProcessor = new SimonConsoleRequestProcessor(urlPrefix);
		if (manager != null) {
			// Defaults to global manager
			requestProcessor.setManager(manager);
		}
		if (pluginClasses != null) {
			requestProcessor.getPluginManager().addPlugins(pluginClasses);
		}
		requestProcessor.initActionBindings();
		return requestProcessor;
	}
325524
public RequestConfig with(Heroku.RequestKey key, Map<Heroku.RequestKey, Either> value) {
        RequestConfig newConfig = copy();
        newConfig.config.put(key, new Either(value));
        return newConfig;
    }
43404
function RequestApi(constructorOptions) {

    LOG.debug('Instantiating new Request object');
    LOG.debug('Validating options');

    try {

        this.options =
            new requestOptions.Constructor().validate(constructorOptions);

    } catch (err) {

        LOG.error('Received error: %s', err);

        throw(
            err
        );

    }

    this.requests = [];
    this.batchId = 1;

}
522007
public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
            return new DefaultClient();
        } else {
            try {
                return (Client) Thread.currentThread().getContextClassLoader().loadClass(clientClassName).newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
615296
function (childFactory, requestor) {
                var context;
                if (childFactory) {

                    var configuration,
                        requestorConfiguration,
                        baseConfiguration = this,
                        isModel = childFactory.classof(Model);

                    context = this.root();

                    if (requestor) {
                        var requestorContext = requestor.$context,
                            contextStack = [];
                        // find correct configuration of requestor
                        while (requestorContext.$contextModel) {
                            contextStack.push(requestorContext);
                            requestorContext = requestorContext.$contextModel.$context;
                        }
                        var rootConfiguration = this,
                            rootContext;
                        while (contextStack.length > 0 && rootConfiguration) {
                            rootContext = contextStack.pop();
                            rootConfiguration = rootConfiguration.getConfigurationForModelClass(rootContext.$contextModel.factory);
                        }
                        var factory = requestor.factory;
                        if (factory.classof(Model)) {
                            requestorConfiguration = rootConfiguration.getConfigurationForModelClass(factory);
                        } else if (factory.classof(Collection)) {
                            requestorConfiguration = rootConfiguration.getConfigurationForCollectionClassName(factory.prototype.$modelFactory);
                        }
                        // starting from the requestors configuration, find correct context of the childFactory
                        if (requestorConfiguration) {
                            context = this.getContextByProperties(requestor, null, requestor.$context);
                            baseConfiguration = requestorConfiguration;
                        }
                        while (baseConfiguration.$parent && context) {
                            if (isModel) {
                                configuration = baseConfiguration.getConfigurationForModelClass(childFactory);
                            } else {
                                configuration = baseConfiguration.getConfigurationForModelClass(childFactory.prototype.$modelFactory);
                            }
                            if (configuration) {
                                // found context
                                break;
                            } else {
                                context = context.$contextModel ? context.$contextModel.$context : null;
                                baseConfiguration = baseConfiguration.$parent;
                            }
                        }
                    }
                }
                return context || this.root();
            }
821294
HttpRequestConfig getRedirectRequestConfig() {
        if (redirectRequestConfig == null) {
            redirectRequestConfig = HttpRequestConfig.builder().setRedirectionValidator(getRedirectionValidator()).build();
        }
        return redirectRequestConfig;
    }
444374
public SslHandler create(ByteBufAllocator bufferAllocator) {
    SSLEngine engine = sslContext.newEngine(bufferAllocator);
    engine.setNeedClientAuth(needClientAuth);
    engine.setUseClientMode(false);
    return new SslHandler(engine);
  }
1211834
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException {
        return null;    // should be really abstract, but not
    }
1227779
private Configuration makeEvaluatorConfiguration(final Configuration contextConfiguration,
                                                   final Optional<Configuration> serviceConfiguration,
                                                   final Optional<Configuration> taskConfiguration) {

    final String contextConfigurationString = this.configurationSerializer.toString(contextConfiguration);

    final Optional<String> taskConfigurationString;
    if (taskConfiguration.isPresent()) {
      taskConfigurationString = Optional.of(this.configurationSerializer.toString(taskConfiguration.get()));
    } else {
      taskConfigurationString = Optional.empty();
    }

    final Optional<Configuration> mergedServiceConfiguration = makeRootServiceConfiguration(serviceConfiguration);
    if (mergedServiceConfiguration.isPresent()) {
      final String serviceConfigurationString = this.configurationSerializer.toString(mergedServiceConfiguration.get());
      return makeEvaluatorConfiguration(contextConfigurationString, Optional.<String>empty(),
          Optional.of(serviceConfigurationString), taskConfigurationString);
    } else {
      return makeEvaluatorConfiguration(
          contextConfigurationString, Optional.<String>empty(), Optional.<String>empty(), taskConfigurationString);
    }
  }
781378
public static ApplicationConfiguration load(InputStream input) throws Exception {
		XMLStreamReader xml = XMLInputFactory.newFactory().createXMLStreamReader(input);
		while (xml.hasNext()) {
			xml.next();
			if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
				if (!"project".equals(xml.getLocalName()))
					throw new Exception("Root element of an lc-project.xml file must be <project>");
				ApplicationConfiguration cfg = new ApplicationConfiguration();
				boolean found = false;
				while (xml.hasNext()) {
					xml.next();
					if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
						if ("application".equals(xml.getLocalName())) {
							found = true;
							cfg.load(xml);
							break;
						}
					}
				}
				if (!found)
					throw new Exception("No application element found in lc-project.xml file");
				return cfg;
			}
		}
		throw new Exception("Nothing found in lc-project.xml file");
	}
144843
public static QueryableStateConfiguration fromConfiguration(Configuration config) {
		if (!config.getBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER)) {
			return null;
		}

		final Iterator<Integer> proxyPorts = NetUtils.getPortRangeFromString(
			config.getString(QueryableStateOptions.PROXY_PORT_RANGE));
		final Iterator<Integer> serverPorts = NetUtils.getPortRangeFromString(
			config.getString(QueryableStateOptions.SERVER_PORT_RANGE));

		final int numProxyServerNetworkThreads = config.getInteger(QueryableStateOptions.PROXY_NETWORK_THREADS);
		final int numProxyServerQueryThreads = config.getInteger(QueryableStateOptions.PROXY_ASYNC_QUERY_THREADS);

		final int numStateServerNetworkThreads = config.getInteger(QueryableStateOptions.SERVER_NETWORK_THREADS);
		final int numStateServerQueryThreads = config.getInteger(QueryableStateOptions.SERVER_ASYNC_QUERY_THREADS);

		return new QueryableStateConfiguration(
			proxyPorts,
			serverPorts,
			numProxyServerNetworkThreads,
			numProxyServerQueryThreads,
			numStateServerNetworkThreads,
			numStateServerQueryThreads);
	}