Class AsynchronousAsyncValidator


  • class AsynchronousAsyncValidator
    extends java.lang.Object
    Class used for asynchronous revalidations to be used when the "stale- while-revalidate" directive is present
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.util.concurrent.ExecutorService getExecutor()  
      (package private) java.util.Set<java.lang.String> getScheduledIdentifiers()  
      (package private) void markComplete​(java.lang.String identifier)
      Removes an identifier from the internal list of revalidation jobs in progress.
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • executor

        private final java.util.concurrent.ExecutorService executor
      • queued

        private final java.util.Set<java.lang.String> queued
      • cacheKeyGenerator

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

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

      • 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,
                                   java.util.concurrent.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 Detail

      • 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​(java.lang.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

        java.util.Set<java.lang.String> getScheduledIdentifiers()
      • getExecutor

        java.util.concurrent.ExecutorService getExecutor()