I have a spring-boot application making a bunch of REST backend calls. One of the Rest backend is throwing a ConnectionPoolTimeoutException. After further investigation, I suspect that the connections are not closed for that backend when the response is an error or is null.
Tried debugging Spring RestTemplate code and saw a line:
finally {
if (response != null) {
response.close();
}
}
which looks like does not close connections if response was null. Has anyone faced similar issue and what was the solution. I am thinking of writing an interceptor which will always close the connection