Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marciorodrigues87/3a98cb02ca1092a18a71eb04085d7b1f to your computer and use it in GitHub Desktop.
Save marciorodrigues87/3a98cb02ca1092a18a71eb04085d7b1f to your computer and use it in GitHub Desktop.
RestTemplateConfigStepFour.java
final HttpClient httpClient = HttpClients.custom()
.setMaxConnPerRoute(100)
.setMaxConnTotal(1000)
.setConnectionTimeToLive(30, MINUTES)
.setRetryHandler((IOException exception, int executionCount, HttpContext context) -> { // <--
return executionCount <= 3; // <--
}) // <--
.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