You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/12/25 15:34:48 UTC

[httpcomponents-client] branch 5.1.x updated: Automatically retry requests that failed with RequestNotExecutedException

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/5.1.x by this push:
     new af59b04  Automatically retry requests that failed with RequestNotExecutedException
af59b04 is described below

commit af59b041da306843f36c3d6125d6050c8f50a034
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Dec 25 16:28:34 2021 +0100

    Automatically retry requests that failed with RequestNotExecutedException
---
 .../apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java
index b1be581..ba78b8f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java
@@ -52,6 +52,7 @@ import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.Method;
+import org.apache.hc.core5.http.RequestNotExecutedException;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.TimeValue;
@@ -176,6 +177,9 @@ public class DefaultHttpRequestRetryStrategy implements HttpRequestRetryStrategy
         if (this.nonRetriableIOExceptionClasses.contains(exception.getClass())) {
             return false;
         } else {
+            if (exception instanceof RequestNotExecutedException) {
+                return true;
+            }
             for (final Class<? extends IOException> rejectException : this.nonRetriableIOExceptionClasses) {
                 if (rejectException.isInstance(exception)) {
                     return false;