com.sun.jersey.api.client.Client.setReadTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(242)

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

Client.setReadTimeout介绍

[英]Set the read timeout interval, in milliseconds. This method is the functional equivalent to setting the property ClientConfig#PROPERTY_READ_TIMEOUT on the property bag returned from #getProperties
[中]设置读取超时时间间隔,以毫秒为单位。此方法的功能相当于在从#getProperties返回的属性包上设置属性ClientConfig#property#READ#TIMEOUT

代码示例

代码示例来源:origin: apache/incubator-druid

public OpentsdbSender(
  String host,
  int port,
  int connectionTimeout,
  int readTimeout,
  int flushThreshold,
  int maxQueueSize,
  long consumeDelay
)
{
 this.flushThreshold = flushThreshold;
 this.consumeDelay = consumeDelay;
 eventQueue = new ArrayBlockingQueue<>(maxQueueSize);
 scheduler = Executors.newScheduledThreadPool(2, new ThreadFactoryBuilder()
   .setDaemon(true)
   .setNameFormat("OpentsdbEventSender-%s")
   .build());
 eventConsumer = new EventConsumer();
 client = Client.create();
 client.setConnectTimeout(connectionTimeout);
 client.setReadTimeout(readTimeout);
 webResource = client.resource("http://" + host + ":" + port + PATH);
}

代码示例来源:origin: soabase/exhibitor

public RemoteInstanceRequestClientImpl(RemoteConnectionConfiguration configuration)
{
  client = Client.create();
  client.setConnectTimeout(configuration.getConnectionTimeoutMs());
  client.setReadTimeout(configuration.getReadTimeoutMs());
  for ( ClientFilter filter : configuration.getFilters() )
  {
    client.addFilter(filter);
  }
}

代码示例来源:origin: docusign/docusign-java-client

/**
 * Set the read timeout (in milliseconds).
 * A value of 0 means no timeout, otherwise values must be between 1 and
 * {@link Integer#MAX_VALUE}.
 */
 public ApiClient setReadTimeout(int readTimeout) {
  this.readTimeout = readTimeout;
  httpClient.setReadTimeout(readTimeout);
  return this;
 }

代码示例来源:origin: apache/eagle

public void setReadTimeout(int timeoutMs) {
  client.setReadTimeout(timeoutMs);
}

代码示例来源:origin: org.apache.apex/malhar-library

@Override
public void setup(OperatorContext context)
{
 wsClient = Client.create();
 wsClient.setFollowRedirects(true);
 wsClient.setReadTimeout(readTimeoutMillis);
 resource = wsClient.resource(url.toString()); // side step "not absolute URL" after serialization
 LOG.info("URL: {}", url);
}

代码示例来源:origin: sriksun/Ivory

private void setIvoryTimeOut(Client client) throws IOException {
  Properties prop = new Properties();
  InputStream input = IvoryClient.class
      .getResourceAsStream("/client.properties");
  int readTimeout = 0;
  int connectTimeout = 0;
  if (input != null) {
    prop.load(input);
    readTimeout = prop.containsKey("ivory.read.timeout") ? Integer
        .parseInt(prop.getProperty("ivory.read.timeout")) : 180000;
    connectTimeout = prop.containsKey("ivory.connect.timeout") ? Integer
        .parseInt(prop.getProperty("ivory.connect.timeout"))
        : 180000;
  } else {
    readTimeout = 180000;
    connectTimeout = 180000;
  }
  client.setConnectTimeout(connectTimeout);
  client.setReadTimeout(readTimeout);
}

代码示例来源:origin: com.qaprosoft/zafira-client

public STFClient(String serviceURL, String authToken)
{
  this.serviceURL = serviceURL;
  this.authToken = authToken;
  this.client = Client.create();
  this.client.setConnectTimeout(TIMEOUT);
  this.client.setReadTimeout(TIMEOUT);
}

代码示例来源:origin: ai.grakn/client-java

GraknClientImpl(SimpleURI url)  {
  this.client = Client.create();
  this.client.setConnectTimeout(CONNECT_TIMEOUT_MS);
  this.client.setReadTimeout(CONNECT_TIMEOUT_MS * 2);
  this.uri = url;
}

代码示例来源:origin: ai.grakn/grakn-client

GraknClientImpl(SimpleURI url)  {
  this.client = Client.create();
  this.client.setConnectTimeout(CONNECT_TIMEOUT_MS);
  this.client.setReadTimeout(CONNECT_TIMEOUT_MS * 2);
  this.uri = url;
}

代码示例来源:origin: qaprosoft/zafira

public STFClient(String serviceURL, String authToken)
{
  this.serviceURL = serviceURL;
  this.authToken = authToken;
  this.client = Client.create();
  this.client.setConnectTimeout(TIMEOUT);
  this.client.setReadTimeout(TIMEOUT);
}

代码示例来源:origin: com.qaprosoft/zafira-client

public ZafiraClient(String serviceURL)
{
  this.serviceURL = serviceURL;
  this.client = Client.create(new DefaultClientConfig(GensonProvider.class));
  this.client.setConnectTimeout(CONNECT_TIMEOUT);
  this.client.setReadTimeout(READ_TIMEOUT);
}

代码示例来源:origin: qaprosoft/zafira

public ZafiraClient(String serviceURL)
{
  this.serviceURL = serviceURL;
  this.client = Client.create(new DefaultClientConfig(GensonProvider.class));
  this.client.setConnectTimeout(CONNECT_TIMEOUT);
  this.client.setReadTimeout(READ_TIMEOUT);
}

代码示例来源:origin: apache/incubator-atlas

client.setReadTimeout(readTimeout);
client.setConnectTimeout(connectTimeout);
return client;

代码示例来源:origin: org.apache.atlas/atlas-client-common

client.setReadTimeout(readTimeout);
client.setConnectTimeout(connectTimeout);
return client;

代码示例来源:origin: kpelykh/docker-java

private DockerClient(Config config) {
  restEndpointUrl = config.url + "/v" + config.version;
  ClientConfig clientConfig = new DefaultClientConfig();
  //clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
  SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme("http", config.url.getPort(), PlainSocketFactory.getSocketFactory()));
  schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
  PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
  // Increase max total connection
  cm.setMaxTotal(1000);
  // Increase default max connection per route
  cm.setDefaultMaxPerRoute(1000);
  HttpClient httpClient = new DefaultHttpClient(cm);
  client = new ApacheHttpClient4(new ApacheHttpClient4Handler(httpClient, null, false), clientConfig);
  client.setReadTimeout(10000);
  //Experimental support for unix sockets:
  //client = new UnixSocketClient(clientConfig);
  client.addFilter(new JsonClientFilter());
  client.addFilter(new LoggingFilter());
}

代码示例来源:origin: com.intuit.data.autumn/autumn.client

client.setReadTimeout(config.getReadTimeOut().get());

代码示例来源:origin: com.intuit.autumn/autumn-client

client.setReadTimeout(config.getReadTimeOut().get());

代码示例来源:origin: com.intuit.autumn/autumn-client

client.setReadTimeout(config.getReadTimeOut().get());

代码示例来源:origin: com.intuit.data.autumn/autumn.client

client.setReadTimeout(config.getReadTimeOut().get());

代码示例来源:origin: org.jenkins-ci.plugins/urltrigger

private Client getClientObject(URLTriggerResolvedEntry resolvedEntry, XTriggerLog log) throws XTriggerException {
  URLTriggerEntry entry = resolvedEntry.getEntry();
  Client client = createClient(resolvedEntry.isHttps(), entry.isProxyActivated());
  if (isAuthBasic(entry)) {
    addBasicAuth(entry, log, client);
  }
  /* Set a connect and read timeout. If this hangs, it can actually
    take down all of the jenkins schedule events.
  */
  int timeout = entry.getTimeout();
  client.setConnectTimeout(timeout * 1000); //in milliseconds
  client.setReadTimeout(timeout * 1000);    //in milliseconds
  return client;
}

相关文章