From e8002ae3b9bbc72467ed5223b929e4a00d1aca5c Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sat, 7 Jan 2017 11:30:28 +0000 Subject: [PATCH] HTTPCLIENT-1800: wrap redirect around retry in execChain git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1777766 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/impl/client/HttpClientBuilder.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java index 507f7d390..294135d39 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java @@ -1148,6 +1148,13 @@ public class HttpClientBuilder { routePlannerCopy = new DefaultRoutePlanner(schemePortResolverCopy); } } + + // Optionally, add service unavailable retry executor + final ServiceUnavailableRetryStrategy serviceUnavailStrategyCopy = this.serviceUnavailStrategy; + if (serviceUnavailStrategyCopy != null) { + execChain = new ServiceUnavailableRetryExec(execChain, serviceUnavailStrategyCopy); + } + // Add redirect executor, if not disabled if (!redirectHandlingDisabled) { RedirectStrategy redirectStrategyCopy = this.redirectStrategy; @@ -1157,11 +1164,6 @@ public class HttpClientBuilder { execChain = new RedirectExec(execChain, routePlannerCopy, redirectStrategyCopy); } - // Optionally, add service unavailable retry executor - final ServiceUnavailableRetryStrategy serviceUnavailStrategyCopy = this.serviceUnavailStrategy; - if (serviceUnavailStrategyCopy != null) { - execChain = new ServiceUnavailableRetryExec(execChain, serviceUnavailStrategyCopy); - } // Optionally, add connection back-off executor if (this.backoffManager != null && this.connectionBackoffStrategy != null) { execChain = new BackoffStrategyExec(execChain, this.connectionBackoffStrategy, this.backoffManager);