Class AsynchronousAsyncValidator
- java.lang.Object
-
- org.apache.http.impl.client.cache.AsynchronousAsyncValidator
-
class AsynchronousAsyncValidator extends java.lang.ObjectClass used for asynchronous revalidations to be used when the "stale- while-revalidate" directive is present
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.impl.client.cache.CacheKeyGeneratorcacheKeyGeneratorprivate CachingHttpAsyncClientcachingAsyncClientprivate java.util.concurrent.ExecutorServiceexecutorprivate org.apache.commons.logging.Loglogprivate java.util.Set<java.lang.String>queued
-
Constructor Summary
Constructors Constructor Description AsynchronousAsyncValidator(CachingHttpAsyncClient cachingClient, java.util.concurrent.ExecutorService executor)Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpAsyncClientandExecutorService.AsynchronousAsyncValidator(CachingHttpAsyncClient cachingClient, org.apache.http.impl.client.cache.CacheConfig config)Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpAsyncClient, and aThreadPoolExecutorgenerated according to the thread pool settings provided in the givenCacheConfig.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.concurrent.ExecutorServicegetExecutor()(package private) java.util.Set<java.lang.String>getScheduledIdentifiers()(package private) voidmarkComplete(java.lang.String identifier)Removes an identifier from the internal list of revalidation jobs in progress.voidrevalidateCacheEntry(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 Detail
-
cachingAsyncClient
private final CachingHttpAsyncClient cachingAsyncClient
-
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 suppliedCachingHttpAsyncClient, and aThreadPoolExecutorgenerated 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, java.util.concurrent.ExecutorService executor)
Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpAsyncClientandExecutorService.- Parameters:
cachingClient- used to execute asynchronous requestsexecutor- 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 byAsynchronousValidationRequest.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()
-
-