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

CachingHttpClientBuilder.build() fails when asynchronousWorkersMax=0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.3 Alpha1
    • 4.3 Beta1
    • HttpCache
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: