本文整理了Java中com.sun.jersey.api.client.Client.setConnectTimeout()
方法的一些代码示例,展示了Client.setConnectTimeout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.setConnectTimeout()
方法的具体详情如下:
包路径:com.sun.jersey.api.client.Client
类名称:Client
方法名:setConnectTimeout
[英]Set the connect timeout interval, in milliseconds. This method is the functional equivalent to setting the property ClientConfig#PROPERTY_CONNECT_TIMEOUT on the property bag returned from #getProperties
[中]设置连接超时时间间隔,以毫秒为单位。此方法的功能相当于在从#getProperties返回的属性包上设置属性ClientConfig#property_CONNECT_超时
代码示例来源: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: uber/AthenaX
/**
* Set the connect timeout (in milliseconds).
* A value of 0 means no timeout, otherwise values must be between 1 and
* {@link Integer#MAX_VALUE}.
* @param connectionTimeout Connection timeout in milliseconds
* @return API client
*/
public ApiClient setConnectTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
httpClient.setConnectTimeout(connectionTimeout);
return this;
}
代码示例来源:origin: docusign/docusign-java-client
/**
* Set the connect timeout (in milliseconds).
* A value of 0 means no timeout, otherwise values must be between 1 and
* {@link Integer#MAX_VALUE}.
*/
public ApiClient setConnectTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
httpClient.setConnectTimeout(connectionTimeout);
return this;
}
代码示例来源:origin: hiddenswitch/Spellsource-Server
/**
* Set the connect timeout (in milliseconds).
* A value of 0 means no timeout, otherwise values must be between 1 and
* {@link Integer#MAX_VALUE}.
* @param connectionTimeout Connection timeout in milliseconds
* @return API client
*/
public ApiClient setConnectTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
httpClient.setConnectTimeout(connectionTimeout);
return this;
}
代码示例来源: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/atlas
client.setConnectTimeout(connectTimeout);
return client;
代码示例来源:origin: apache/incubator-atlas
client.setConnectTimeout(connectTimeout);
return client;
代码示例来源:origin: org.apache.atlas/atlas-client-common
client.setConnectTimeout(connectTimeout);
return client;
代码示例来源:origin: com.intuit.data.autumn/autumn.client
client.setConnectTimeout(config.getConnectionTimeout().get());
代码示例来源:origin: com.intuit.autumn/autumn-client
client.setConnectTimeout(config.getConnectionTimeout().get());
代码示例来源:origin: com.intuit.autumn/autumn-client
client.setConnectTimeout(config.getConnectionTimeout().get());
代码示例来源:origin: com.intuit.data.autumn/autumn.client
client.setConnectTimeout(config.getConnectionTimeout().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;
}
内容来源于网络,如有侵权,请联系作者删除!