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
This commit is contained in:
Oleg Kalnichevski 2014-06-19 08:28:39 +00:00
parent ad092c5d03
commit d66b842b79
1 changed files with 29 additions and 1 deletions

View File

@ -700,6 +700,34 @@ public class HttpClientBuilder {
return this; return this;
} }
/**
* Produces an instance of {@link ClientExecChain} to be used as a main exec.
* <p>
* Default implementation produces an instance of {@link MainClientExec}
* <p>
* 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. * For internal use.
*/ */
@ -835,7 +863,7 @@ public class HttpClientBuilder {
userTokenHandlerCopy = NoopUserTokenHandler.INSTANCE; userTokenHandlerCopy = NoopUserTokenHandler.INSTANCE;
} }
} }
ClientExecChain execChain = new MainClientExec( ClientExecChain execChain = createMainExec(
requestExecCopy, requestExecCopy,
connManagerCopy, connManagerCopy,
reuseStrategyCopy, reuseStrategyCopy,