michael-o commented on a change in pull request #37: [WAGON-526] making the 
retry handle of http client configurable
URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211380988
 
 

 ##########
 File path: 
wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
 ##########
 @@ -354,6 +366,97 @@ private static PoolingHttpClientConnectionManager 
createConnManager()
         return connManager;
     }
 
+    /**
+     * The type of the retry handler, default to 
DefaultHttpRequestRetryHandler.
+     * Values can be default, standard (StandardHttpRequestRetryHandler), or a 
fully qualified name class.
+     *
+     * @since 3.0.1
+     */
+    private static final String RETRY_HANDLER_CLASS =
+            System.getProperty( "maven.wagon.http.retryhandler.class", "auto" 
);
+
+    /**
+     * true if it's OK to retry non-idempotent requests that have been sent.
+     * Note: only used for default and standard retry handlers.
+     *
+     * @since 3.0.1
+     */
+    private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED =
+            Boolean.getBoolean( 
"maven.wagon.http.retryhandler.requestSentEnabled" );
+
+    /**
+     * Number of retries for the retry handler.
+     * Note: only used for default and standard retry handlers.
+     *
+     * @since 3.0.1
+     */
+    private static final int RETRY_HANDLER_COUNT =
+            Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 );
+
+    private static final String DEFAULT_NON_RETRYABLE_CLASSES =
+            InterruptedIOException.class.getName() + ","
+            + UnknownHostException.class.getName() + ","
+            + ConnectException.class.getName() + ","
+            + SSLException.class.getName();
+    /**
+     * Comma separated list of non retryable classes.
+     * Note: only used for default retry handler.
+     *
+     * @since 3.0.1
+     */
+    private static final String RETRY_HANDLER_EXCEPTIONS =
+            System.getProperty( 
"maven.wagon.http.retryhandler.nonRetryableClasses", 
DEFAULT_NON_RETRYABLE_CLASSES );
+
+    private static HttpRequestRetryHandler createRetryHandler()
+    {
+        switch ( RETRY_HANDLER_CLASS )
+        {
+            case "default":
+                if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( 
RETRY_HANDLER_EXCEPTIONS ) )
+                {
+                    return new DefaultHttpRequestRetryHandler(
+                            RETRY_HANDLER_COUNT, 
RETRY_HANDLER_REQUEST_SENT_ENABLED );
+                }
+                return new DefaultHttpRequestRetryHandler(
+                        RETRY_HANDLER_COUNT, 
RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() )
+                {
+                };
+            case "standard":
+                return new StandardHttpRequestRetryHandler( 
RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED );
+            case "auto":
 
 Review comment:
   This needs to be dropped completely.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to