Class CacheRevalidatorBase
- java.lang.Object
-
- org.apache.hc.client5.http.impl.cache.CacheRevalidatorBase
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
DefaultAsyncCacheRevalidator,DefaultCacheRevalidator
class CacheRevalidatorBase extends java.lang.Object implements java.io.CloseableAbstract cache re-validation class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceCacheRevalidatorBase.ScheduledExecutor
-
Field Summary
Fields Modifier and Type Field Description private ConcurrentCountMap<java.lang.String>failureCacheprivate static org.slf4j.LoggerLOGprivate java.util.Set<java.lang.String>pendingRequestprivate CacheRevalidatorBase.ScheduledExecutorscheduledExecutorprivate SchedulingStrategyschedulingStrategy
-
Constructor Summary
Constructors Constructor Description CacheRevalidatorBase(java.util.concurrent.ScheduledThreadPoolExecutor scheduledThreadPoolExecutor, SchedulingStrategy schedulingStrategy)Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategyandScheduledThreadPoolExecutor.CacheRevalidatorBase(CacheRevalidatorBase.ScheduledExecutor scheduledExecutor, SchedulingStrategy schedulingStrategy)Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategyandCacheRevalidatorBase.ScheduledExecutor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitTermination(org.apache.hc.core5.util.Timeout timeout)voidclose()(package private) java.util.Set<java.lang.String>getScheduledIdentifiers()(package private) booleanisStale(org.apache.hc.core5.http.HttpResponse httpResponse)Determines if the given response is generated from a stale cache entry.(package private) voidjobFailed(java.lang.String identifier)(package private) voidjobSuccessful(java.lang.String identifier)(package private) voidscheduleRevalidation(java.lang.String cacheKey, java.lang.Runnable command)Schedules an asynchronous re-validationstatic CacheRevalidatorBase.ScheduledExecutorwrap(java.util.concurrent.ScheduledExecutorService executorService)
-
-
-
Field Detail
-
scheduledExecutor
private final CacheRevalidatorBase.ScheduledExecutor scheduledExecutor
-
schedulingStrategy
private final SchedulingStrategy schedulingStrategy
-
pendingRequest
private final java.util.Set<java.lang.String> pendingRequest
-
failureCache
private final ConcurrentCountMap<java.lang.String> failureCache
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Detail
-
CacheRevalidatorBase
public CacheRevalidatorBase(CacheRevalidatorBase.ScheduledExecutor scheduledExecutor, SchedulingStrategy schedulingStrategy)
Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategyandCacheRevalidatorBase.ScheduledExecutor.
-
CacheRevalidatorBase
public CacheRevalidatorBase(java.util.concurrent.ScheduledThreadPoolExecutor scheduledThreadPoolExecutor, SchedulingStrategy schedulingStrategy)Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategyandScheduledThreadPoolExecutor.
-
-
Method Detail
-
wrap
public static CacheRevalidatorBase.ScheduledExecutor wrap(java.util.concurrent.ScheduledExecutorService executorService)
-
scheduleRevalidation
void scheduleRevalidation(java.lang.String cacheKey, java.lang.Runnable command)Schedules an asynchronous re-validation
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
awaitTermination
public void awaitTermination(org.apache.hc.core5.util.Timeout timeout) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
jobSuccessful
void jobSuccessful(java.lang.String identifier)
-
jobFailed
void jobFailed(java.lang.String identifier)
-
getScheduledIdentifiers
java.util.Set<java.lang.String> getScheduledIdentifiers()
-
isStale
boolean isStale(org.apache.hc.core5.http.HttpResponse httpResponse)
Determines if the given response is generated from a stale cache entry.- Parameters:
httpResponse- the response to be checked- Returns:
- whether the response is stale or not
-
-