I have this code:
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(40 * 1000)
.setConnectionRequestTimeout(40 * 1000)
.setSocketTimeout(40 * 1000)
.build();
client = HttpClientBuilder
.create()
.setDefaultRequestConfig(requestConfig)
.build();
}
and
try {
Stopwatch stopWatch = Stopwatch.createStarted();
response = client.execute(new HttpGet(routingRequestUrl));
stopWatch.stop();
} catch (Exception e) {
answer.errorMsg = e.getMessage();
answer.latency = null;
}
when my client configuration does not contain .setSocketTimeout(40 *
1000)- showWatch request may take more than 1 minute.
This happens when I try to execute setConnectTimeoutand setConnectionRequestTimeouteach separately or all together.
Why only .setSocketTimeout(40 * 1000)effectively checks for a timeout of 40 seconds? and the other is not?
These are the fingerprints:
Read timed out
Timeout waiting for connection from pool
The first is called setConnectionRequestTimeout, and the second is setSocketTimeout?
source
share