1 回答

TA貢獻1851條經驗 獲得超5個贊
我創建了 HttpRequestRetryHandler 類。
public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
IOException cause = exception;
if (exception instanceof SSLException) {
if (exception.getCause() != null && exception.getCause() instanceof IOException) {
cause = (IOException) exception.getCause();
}
}
return super.retryRequest(cause, executionCount, context);
}
}
并將其設置為 HttpClientBuilder。
CloseableHttpClient httpclient = HttpClients.custom()
.setRetryHandler(new HttpRequestRetryHandler())
.build();
結論
SSL 通信質量與使用 java8 時相同。
服務器或網絡底層問題依然存在,但java11的影響已經解決。
添加回答
舉報