Class CachingHttpClient.AsynchronousValidator
- java.lang.Object
-
- org.apache.http.impl.client.cache.CachingHttpClient.AsynchronousValidator
-
- Enclosing class:
- CachingHttpClient
static class CachingHttpClient.AsynchronousValidator extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private CacheKeyGeneratorcacheKeyGeneratorprivate CachingHttpClientcachingClientprivate java.util.concurrent.ExecutorServiceexecutorprivate org.apache.commons.logging.Loglogprivate java.util.Set<java.lang.String>queued
-
Constructor Summary
Constructors Constructor Description AsynchronousValidator(CachingHttpClient cachingClient, java.util.concurrent.ExecutorService executor)Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpClientandExecutorService.AsynchronousValidator(CachingHttpClient cachingClient, CacheConfig config)Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpClient, 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, HttpRequestWrapper request, org.apache.http.protocol.HttpContext context, HttpCacheEntry entry)Schedules an asynchronous revalidation
-
-
-
Field Detail
-
cachingClient
private final CachingHttpClient cachingClient
-
executor
private final java.util.concurrent.ExecutorService executor
-
queued
private final java.util.Set<java.lang.String> queued
-
cacheKeyGenerator
private final CacheKeyGenerator cacheKeyGenerator
-
log
private final org.apache.commons.logging.Log log
-
-
Constructor Detail
-
AsynchronousValidator
public AsynchronousValidator(CachingHttpClient cachingClient, CacheConfig config)
Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpClient, 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().
-
AsynchronousValidator
AsynchronousValidator(CachingHttpClient cachingClient, java.util.concurrent.ExecutorService executor)
Create AsynchronousValidator which will make revalidation requests using the suppliedCachingHttpClientandExecutorService.- 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, HttpRequestWrapper request, org.apache.http.protocol.HttpContext context, HttpCacheEntry entry)Schedules an asynchronous revalidation- Parameters:
target-request-context-entry-
-
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 byCachingHttpClient.AsynchronousValidationRequest.run()once the revalidation is complete, using the identifier passed in during constructions.- Parameters:
identifier-
-
getScheduledIdentifiers
java.util.Set<java.lang.String> getScheduledIdentifiers()
-
getExecutor
java.util.concurrent.ExecutorService getExecutor()
-
-