Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1324

CachingHttpClientBuilder.build() fails when asynchronousWorkersMax=0

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.3 Alpha1
    • Fix Version/s: 4.3 Beta1
    • Component/s: HttpCache
    • Labels:
      None

      Description

      The following code throws an Exception:
      CacheConfig cacheConfig = CacheConfig.custom().setAsynchronousWorkersMax(0).build();
      CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).build();

      java.lang.IllegalArgumentException
      at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:826)
      at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:717)
      at org.apache.http.impl.client.cache.AsynchronousValidator.<init>(AsynchronousValidator.java:74)
      at org.apache.http.impl.client.cache.CachingHttpClientBuilder.createAsynchronousRevalidator(CachingHttpClientBuilder.java:106)
      at org.apache.http.impl.client.cache.CachingHttpClientBuilder.decorateMainExec(CachingHttpClientBuilder.java:100)
      at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:528)

      According to the javadoc of method org.apache.http.impl.client.cache.CacheConfig.Builder.setAsynchronousWorkersMax(int) "a value of 0 disables background revalidations"

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              fx.bonnet Francois-Xavier Bonnet
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: