Class AsynchronousAsyncValidator
java.lang.Object
org.apache.http.impl.client.cache.AsynchronousAsyncValidator
Class used for asynchronous revalidations to be used when the "stale-
while-revalidate" directive is present
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.http.impl.client.cache.CacheKeyGenerator
private final CachingHttpAsyncClient
private final ExecutorService
private final org.apache.commons.logging.Log
-
Constructor Summary
ConstructorsConstructorDescriptionAsynchronousAsyncValidator
(CachingHttpAsyncClient cachingClient, ExecutorService executor) Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpAsyncClient
andExecutorService
.AsynchronousAsyncValidator
(CachingHttpAsyncClient cachingClient, org.apache.http.impl.client.cache.CacheConfig config) Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpAsyncClient
, and aThreadPoolExecutor
generated according to the thread pool settings provided in the givenCacheConfig
. -
Method Summary
Modifier and TypeMethodDescription(package private) ExecutorService
(package private) void
markComplete
(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
-
Field Details
-
cachingAsyncClient
-
executor
-
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 suppliedCachingHttpAsyncClient
, and aThreadPoolExecutor
generated according to the thread pool settings provided in the givenCacheConfig
.- Parameters:
cachingClient
- used to execute asynchronous requestsconfig
- specifies thread pool settings. SeeCacheConfig.getAsynchronousWorkersMax()
,CacheConfig.getAsynchronousWorkersCore()
,CacheConfig.getAsynchronousWorkerIdleLifetimeSecs()
, andCacheConfig.getRevalidationQueueSize()
.
-
AsynchronousAsyncValidator
AsynchronousAsyncValidator(CachingHttpAsyncClient cachingClient, ExecutorService executor) Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpAsyncClient
andExecutorService
.- Parameters:
cachingClient
- used to execute asynchronous requestsexecutor
- 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
Removes an identifier from the internal list of revalidation jobs in progress. This is meant to be called byAsynchronousValidationRequest.run()
once the revalidation is complete, using the identifier passed in during constructions. -
getScheduledIdentifiers
-
getExecutor
ExecutorService getExecutor()
-