Java 设置HttpAsyncClient的重试次数
使用典型的Java 设置HttpAsyncClient的重试次数,java,apache-httpclient-4.x,apache-httpcomponents,apache-httpasyncclient,Java,Apache Httpclient 4.x,Apache Httpcomponents,Apache Httpasyncclient,使用典型的HttpAsyncClients示例: public class AsyncClientHttpExchange { public static void main(final String[] args) throws Exception { CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); try { httpclient.
HttpAsyncClients
示例:
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");
}
}
HttpAsyncClient的方法是什么?HttpAsyncClient 4.x不支持自动请求重新执行。此功能计划用于HttpAsyncClient 5.0感谢您的回答@olegIt已经发布
httpClientBuilder.setRetryHandler(new MyRequestRetryHandler(_maxRetryCount));