You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by mi...@apache.org on 2019/12/05 20:56:25 UTC

[httpcomponents-client] branch HTTPCLIENT-2034 updated: Fix issues

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

michaelo pushed a commit to branch HTTPCLIENT-2034
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/HTTPCLIENT-2034 by this push:
     new 50a1276  Fix issues
50a1276 is described below

commit 50a12769364b0b8b00e028eb78355021f06dd15b
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Dec 5 21:54:32 2019 +0100

    Fix issues
---
 .../hc/client5/http/HttpRequestRetryStrategy.java  | 23 +++++++++++-----------
 .../http/impl/DefaultHttpRequestRetryStrategy.java |  2 +-
 .../http/impl/async/AsyncHttpRequestRetryExec.java | 20 ++++---------------
 .../http/impl/classic/HttpRequestRetryExec.java    |  2 +-
 4 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/HttpRequestRetryStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/HttpRequestRetryStrategy.java
index 4c78d77..eb9d422 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/HttpRequestRetryStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/HttpRequestRetryStrategy.java
@@ -52,38 +52,39 @@ public interface HttpRequestRetryStrategy {
      *
      * @param request request failed die to an I/O exception.
      * @param exception the exception that occurred
-     * @param executionCount the number of times this method has been
-     *                       unsuccessfully executed
+     * @param execCount the number of times this method has been
+     *                  unsuccessfully executed
      * @param context the context for the request execution
      *
      * @return {@code true} if the method should be retried, {@code false}
-     * otherwise
+     *         otherwise
      */
-    boolean retryRequest(HttpRequest request, IOException exception, int executionCount, HttpContext context);
+    boolean retryRequest(HttpRequest request, IOException exception, int execCount, HttpContext context);
 
     /**
      * Determines if a method should be retried given the response from
      * the target server.
      *
      * @param response the response from the target server
-     * @param executionCount the number of times this method has been
-     *                       unsuccessfully executed
+     * @param execCount the number of times this method has been
+     *                  unsuccessfully executed
      * @param context the context for the request execution
+     *
      * @return {@code true} if the method should be retried, {@code false}
-     * otherwise
+     *         otherwise
      */
-    boolean retryRequest(HttpResponse response, int executionCount, HttpContext context);
+    boolean retryRequest(HttpResponse response, int execCount, HttpContext context);
 
     /**
      * Determines the retry interval between subsequent retries.
 
      * @param response the response from the target server
-     * @param executionCount the number of times this method has been
-     * unsuccessfully executed
+     * @param execCount the number of times this method has been
+     *                  unsuccessfully executed
      * @param context the context for the request execution
      *
      * @return the retry interval between subsequent retries
      */
-    TimeValue getRetryInterval(HttpResponse response, int executionCount, HttpContext context);
+    TimeValue getRetryInterval(HttpResponse response, int execCount, HttpContext context);
 
 }
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 140a941..23e2ee7 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
@@ -90,7 +90,7 @@ public class DefaultHttpRequestRetryStrategy implements HttpRequestRetryStrategy
             final TimeValue defaultRetryInterval,
             final Collection<Class<? extends IOException>> clazzes,
             final Collection<Integer> codes) {
-        Args.positive(maxRetries, "maxRetries");
+        Args.notNegative(maxRetries, "maxRetries");
         Args.positive(defaultRetryInterval.getDuration(), "defaultRetryInterval");
         this.maxRetries = maxRetries;
         this.defaultRetryInterval = defaultRetryInterval;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java
index 475ba65..194615c 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java
@@ -51,22 +51,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Request execution handler in the asynchronous request execution chain
- * responsbile for making a decision whether a request failed due to
- * an I/O error should be re-executed.
- * <p>
- * Further responsibilities such as communication with the opposite
- * endpoint is delegated to the next executor in the request execution
- * chain.
- * </p>
- *
- * @since 5.0
- */
-/**
- * Request executor in the asynchronousrequest execution chain that is
- * responsible for making a decision whether a request failed due to an
- * I/O error* or received specific response status codes from the target
- * server should be re-executed.
+ * Request executor in the asynchronou srequest execution chain that is
+ * responsible for making a decision whether a request than failed due to
+ * an I/O error or received specific response from the target server should
+ * be re-executed.
  * <p>
  * Further responsibilities such as communication with the opposite
  * endpoint is delegated to the next executor in the request execution
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpRequestRetryExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpRequestRetryExec.java
index b711715..748d3f1 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpRequestRetryExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpRequestRetryExec.java
@@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Request executor in the request execution chain that is responsible for
  * making a decision whether a request that failed due to an I/O error
- * or received specific response status codes from the target server should
+ * or received specific response from the target server should
  * be re-executed.
  * <p>
  * Further responsibilities such as communication with the opposite