You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Marco Balieiro (Jira)" <ji...@apache.org> on 2021/12/02 15:20:00 UTC

[jira] [Created] (HTTPCLIENT-2190) HttpClientBuilder does not configure correctly the HttpClientConnectionManager

Marco Balieiro created HTTPCLIENT-2190:
------------------------------------------

             Summary: HttpClientBuilder does not configure correctly the HttpClientConnectionManager
                 Key: HTTPCLIENT-2190
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2190
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (classic)
    Affects Versions: 4.5.13
            Reporter: Marco Balieiro


The class HttpClientBuilder does not configure correctly the HttpClientConnectionManager properties "maxTotal" and "defaultMaxPerRoute" if I already provided a ConnectionManager.

I sugest that the code on line 1000 should be put out of the "if" that tests if the "connManagerCopy" is null. Some think like this:

      if (connManagerCopy instanceof ConnPoolControl) {
            ConnPoolControl<?> connPoolControl = (ConnPoolControl<?>) connManagerCopy;
            if (systemProperties) {
                String s = System.getProperty("http.keepAlive", "true");
                if ("true".equalsIgnoreCase(s)) {
                    s = System.getProperty("http.maxConnections", "5");
                    final int max = Integer.parseInt(s);
                    connPoolControl.setDefaultMaxPerRoute(max);
                    connPoolControl.setMaxTotal(2 * max);
                }
            }
            if (maxConnTotal > 0) {
                connPoolControl.setMaxTotal(maxConnTotal);
            }
            if (maxConnPerRoute > 0) {
                connPoolControl.setDefaultMaxPerRoute(maxConnPerRoute);
            }
        }



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org