static class CachingHttpClient.AsynchronousValidator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private CacheKeyGenerator |
cacheKeyGenerator |
private CachingHttpClient |
cachingClient |
private java.util.concurrent.ExecutorService |
executor |
private org.apache.commons.logging.Log |
log |
private java.util.Set<java.lang.String> |
queued |
| Constructor and Description |
|---|
AsynchronousValidator(CachingHttpClient cachingClient,
CacheConfig config)
Create AsynchronousValidator which will make revalidation requests
using the supplied
CachingHttpClient, and
a ThreadPoolExecutor generated according to the thread
pool settings provided in the given CacheConfig. |
AsynchronousValidator(CachingHttpClient cachingClient,
java.util.concurrent.ExecutorService executor)
Create AsynchronousValidator which will make revalidation requests
using the supplied
CachingHttpClient and
ExecutorService. |
| Modifier and Type | Method and 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,
HttpRequestWrapper request,
org.apache.http.protocol.HttpContext context,
HttpCacheEntry entry)
Schedules an asynchronous revalidation
|
private final CachingHttpClient cachingClient
private final java.util.concurrent.ExecutorService executor
private final java.util.Set<java.lang.String> queued
private final CacheKeyGenerator cacheKeyGenerator
private final org.apache.commons.logging.Log log
public AsynchronousValidator(CachingHttpClient cachingClient, CacheConfig config)
CachingHttpClient, and
a ThreadPoolExecutor generated according to the thread
pool settings provided in the given CacheConfig.cachingClient - used to execute asynchronous requestsconfig - specifies thread pool settings. See
CacheConfig.getAsynchronousWorkersMax(),
CacheConfig.getAsynchronousWorkersCore(),
CacheConfig.getAsynchronousWorkerIdleLifetimeSecs(),
and CacheConfig.getRevalidationQueueSize().AsynchronousValidator(CachingHttpClient cachingClient, java.util.concurrent.ExecutorService executor)
CachingHttpClient and
ExecutorService.cachingClient - used to execute asynchronous requestsexecutor - used to manage a thread pool of revalidation workerspublic void revalidateCacheEntry(org.apache.http.HttpHost target,
HttpRequestWrapper request,
org.apache.http.protocol.HttpContext context,
HttpCacheEntry entry)
target - request - context - entry - void markComplete(java.lang.String identifier)
AsynchronousValidationRequest.run() once the revalidation is
complete, using the identifier passed in during constructions.identifier - java.util.Set<java.lang.String> getScheduledIdentifiers()
java.util.concurrent.ExecutorService getExecutor()