Class AsynchronousAsyncValidator

java.lang.Object
org.apache.http.impl.client.cache.AsynchronousAsyncValidator

class AsynchronousAsyncValidator extends Object
Class used for asynchronous revalidations to be used when the "stale- while-revalidate" directive is present
  • Field Details

    • cachingAsyncClient

      private final CachingHttpAsyncClient cachingAsyncClient
    • executor

      private final ExecutorService executor
    • queued

      private final Set<String> queued
    • cacheKeyGenerator

      private final org.apache.http.impl.client.cache.CacheKeyGenerator cacheKeyGenerator
    • log

      private final org.apache.commons.logging.Log log
  • Constructor Details

    • AsynchronousAsyncValidator

      public AsynchronousAsyncValidator(CachingHttpAsyncClient cachingClient, org.apache.http.impl.client.cache.CacheConfig config)
      Create AsynchronousValidator which will make revalidation requests using the supplied CachingHttpAsyncClient, and a ThreadPoolExecutor generated according to the thread pool settings provided in the given CacheConfig.
      Parameters:
      cachingClient - used to execute asynchronous requests
      config - specifies thread pool settings. See CacheConfig.getAsynchronousWorkersMax(), CacheConfig.getAsynchronousWorkersCore(), CacheConfig.getAsynchronousWorkerIdleLifetimeSecs(), and CacheConfig.getRevalidationQueueSize().
    • AsynchronousAsyncValidator

      AsynchronousAsyncValidator(CachingHttpAsyncClient cachingClient, ExecutorService executor)
      Create AsynchronousValidator which will make revalidation requests using the supplied CachingHttpAsyncClient and ExecutorService.
      Parameters:
      cachingClient - used to execute asynchronous requests
      executor - used to manage a thread pool of revalidation workers
  • Method Details

    • revalidateCacheEntry

      public void revalidateCacheEntry(org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry)
      Schedules an asynchronous revalidation
    • markComplete

      void markComplete(String identifier)
      Removes an identifier from the internal list of revalidation jobs in progress. This is meant to be called by AsynchronousValidationRequest.run() once the revalidation is complete, using the identifier passed in during constructions.
    • getScheduledIdentifiers

      Set<String> getScheduledIdentifiers()
    • getExecutor

      ExecutorService getExecutor()