org.eclipse.jetty.client.HttpClient.setAddressResolutionTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.eclipse.jetty.client.HttpClient.setAddressResolutionTimeout()方法的一些代码示例,展示了HttpClient.setAddressResolutionTimeout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setAddressResolutionTimeout()方法的具体详情如下:
包路径:org.eclipse.jetty.client.HttpClient
类名称:HttpClient
方法名:setAddressResolutionTimeout

HttpClient.setAddressResolutionTimeout介绍

[英]Sets the socket address resolution timeout used by the default SocketAddressResolvercreated by this HttpClient at startup.

For more fine tuned configuration of socket address resolution, see #setSocketAddressResolver(SocketAddressResolver).
[中]设置此HttpClient在启动时创建的默认SocketAddressResolver使用的套接字地址解析超时。
有关套接字地址解析的更精细配置,请参阅#setSocketAddressResolver(SocketAddressResolver)。

代码示例

代码示例来源:origin: sixt/ja-micro

@Provides
public HttpClient getHttpClient() {
  HttpClient client = new HttpClient();
  client.setFollowRedirects(false);
  client.setMaxConnectionsPerDestination(32);
  client.setConnectTimeout(100);
  client.setAddressResolutionTimeout(100);
  //You can set more restrictive timeouts per request, but not less, so
  //  we set the maximum timeout of 1 hour here.
  client.setIdleTimeout(60 * 60 * 1000);
  try {
    client.start();
  } catch (Exception e) {
    logger.error("Error building http client", e);
  }
  return client;
}

代码示例来源:origin: sixt/ja-micro

private HttpClient createHttpClient() {
  //Allow ssl by default
  SslContextFactory sslContextFactory = new SslContextFactory();
  //Don't exclude RSA because Sixt needs them, dammit!
  sslContextFactory.setExcludeCipherSuites("");
  HttpClient client = new HttpClient(sslContextFactory);
  client.setFollowRedirects(false);
  client.setMaxConnectionsPerDestination(16);
  client.setRequestBufferSize(65536);
  client.setConnectTimeout(FeatureFlags.getHttpConnectTimeout(serviceProperties));
  client.setAddressResolutionTimeout(FeatureFlags.getHttpAddressResolutionTimeout(serviceProperties));
  //You can set more restrictive timeouts per request, but not less, so
  //  we set the maximum timeout of 1 hour here.
  client.setIdleTimeout(60 * 60 * 1000);
  try {
    client.start();
  } catch (Exception e) {
    logger.error("Error building http client", e);
  }
  return client;
}

代码示例来源:origin: danielflower/app-runner

private HttpClient createClient() throws Exception {
  int selectors = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
  HttpClient client = new HttpClient(new HttpClientTransportOverHTTP(selectors), new SslContextFactory(true));
  client.setFollowRedirects(false);
  client.setCookieStore(new HttpCookieStore.Empty());
  client.setMaxConnectionsPerDestination(256);
  client.setAddressResolutionTimeout(15000);
  client.setConnectTimeout(15000);
  client.setIdleTimeout(idleTimeout);
  client.setUserAgentField(null);
  client.start();
  client.getContentDecoderFactories().clear();
  return client;
}

代码示例来源:origin: org.attribyte/attribyte-http

this.httpClient.setResponseBufferSize(options.responseBufferSize);
this.httpClient.setIdleTimeout(options.getIntProperty("idleTimeout", 0));
this.httpClient.setAddressResolutionTimeout(options.getIntProperty("addressResolutionTimeout", 15000));
this.httpClient.setMaxRedirects(options.getIntProperty("maxRedirects", 8));
this.httpClient.setMaxRequestsQueuedPerDestination(options.getIntProperty("maxRequestsQueuedPerDestination", 1024));

代码示例来源:origin: com.proofpoint.platform/http-client

httpClient.setAddressResolutionTimeout(config.getConnectTimeout().toMillis());
  httpClient.setAddressResolutionTimeout(connectTimeout);

代码示例来源:origin: airlift/airlift

httpClient.setAddressResolutionTimeout(config.getConnectTimeout().toMillis());

相关文章

HttpClient类方法