From d66b842b79592eeb6055312c0bbbae2e35b71432 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Thu, 19 Jun 2014 08:28:39 +0000 Subject: [PATCH] HTTPCLIENT-1521: Added factory method for creation of main exec, which enables subclasses of HttpClientBuilder to override the default implementation git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1603755 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/client/HttpClientBuilder.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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 187d35ffd..7bdc8d4f3 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 @@ -700,6 +700,34 @@ public class HttpClientBuilder { return this; } + /** + * Produces an instance of {@link ClientExecChain} to be used as a main exec. + *

+ * Default implementation produces an instance of {@link MainClientExec} + *

+ * For internal use. + * + * @since 4.4 + */ + protected ClientExecChain createMainExec( + final HttpRequestExecutor requestExec, + final HttpClientConnectionManager connManager, + final ConnectionReuseStrategy reuseStrategy, + final ConnectionKeepAliveStrategy keepAliveStrategy, + final AuthenticationStrategy targetAuthStrategy, + final AuthenticationStrategy proxyAuthStrategy, + final UserTokenHandler userTokenHandler) + { + return new MainClientExec( + requestExec, + connManager, + reuseStrategy, + keepAliveStrategy, + targetAuthStrategy, + proxyAuthStrategy, + userTokenHandler); + } + /** * For internal use. */ @@ -835,7 +863,7 @@ public class HttpClientBuilder { userTokenHandlerCopy = NoopUserTokenHandler.INSTANCE; } } - ClientExecChain execChain = new MainClientExec( + ClientExecChain execChain = createMainExec( requestExecCopy, connManagerCopy, reuseStrategyCopy,