Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marciorodrigues87/c57354f3ae88051c5e6204f15161628b to your computer and use it in GitHub Desktop.
Save marciorodrigues87/c57354f3ae88051c5e6204f15161628b to your computer and use it in GitHub Desktop.
RestTemplateConfigStepFive.java
final HttpClient httpClient = HttpClients.custom()
.setMaxConnPerRoute(100)
.setMaxConnTotal(1000)
.setConnectionTimeToLive(30, MINUTES)
.setRetryHandler((IOException exception, int executionCount, HttpContext context) -> {
return executionCount <= 3;
})
.setServiceUnavailableRetryStrategy(new DefaultServiceUnavailableRetryStrategy(3, 1)) // <--
.build();
final RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment