0
votes

We have an application where we do some internal http calls to a REST API to fetch the data. But some requests are taking longer than expected so I am trying to increase the timeout duration. I tried below things :

RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30 * 1000).build(); HttpClient httpClient = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build();

But this doesn't solve my issue. This solution works only for the first time. But when I re run this request I get the timeout exception. Can anyone help me with this.

Below is the stack trace

HttpResponseProxy{HTTP/1.1 504 GATEWAY_TIMEOUT [Content-Length: 0, Connection: keep-alive] [Content-Length: 0,Chunked: false]}

1
That's not a stack trace. - slim
This is the only response I get from the Server. Server meaning I am accessing a REST API to get the data. Let me know if I am not clear - Rakesh Gourineni

1 Answers

0
votes

You should also set socketTimeout (with setSocketTimeout() method).