With the typical HttpAsyncClients
example:
public class AsyncClientHttpExchange {
public static void main(final String[] args) throws Exception {
CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
try {
httpclient.start();
HttpGet request = new HttpGet("http://httpbin.org/get");
Future<HttpResponse> future = httpclient.execute(request, null);
HttpResponse response = future.get();
System.out.println("Response: " + response.getStatusLine());
System.out.println("Shutting down");
} finally {
httpclient.close();
}
System.out.println("Done");
}
}
What is the way to set the number of retries in case there is no response?. I can see 5.
With httpClientBuilder
there is the setRetryHandler
:
httpClientBuilder.setRetryHandler(new MyRequestRetryHandler(_maxRetryCount));
What is the way with HttpAsyncClients
?