title: Retry java RestTemplate HTTP request if host offline
body: <p>Hi I'm using the spring <code>RestTemplate</code> for calling a REST API. The API can be very slow or even offline. My application is building the cache by sending thousands of requests one after the other. The responses can be very slow too, because they contains a lot of data.</p>
  
  <p>I have already increased the Timeout to 120 seconds. My problem now it that the API can be offline and I get a <code>org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool</code> exception.</p>
  
  <p>In the case when the API ist offline, the application should wait and try again until the API is online again.</p>
  
  <p>Can I achieve this in <code>RestTemplate</code> out of the box without building exception-loops on my own?</p>
  
  <p>Thanks!</p>