Class CacheRevalidatorBase
java.lang.Object
org.apache.hc.client5.http.impl.cache.CacheRevalidatorBase
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
DefaultAsyncCacheRevalidator
,DefaultCacheRevalidator
Abstract cache re-validation class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentCountMap
<String> private static final org.slf4j.Logger
private final CacheRevalidatorBase.ScheduledExecutor
private final SchedulingStrategy
-
Constructor Summary
ConstructorsConstructorDescriptionCacheRevalidatorBase
(ScheduledThreadPoolExecutor scheduledThreadPoolExecutor, SchedulingStrategy schedulingStrategy) Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategy
andScheduledThreadPoolExecutor
.CacheRevalidatorBase
(CacheRevalidatorBase.ScheduledExecutor scheduledExecutor, SchedulingStrategy schedulingStrategy) Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategy
andCacheRevalidatorBase.ScheduledExecutor
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
awaitTermination
(org.apache.hc.core5.util.Timeout timeout) void
close()
(package private) boolean
isStale
(org.apache.hc.core5.http.HttpResponse httpResponse) Determines if the given response is generated from a stale cache entry.(package private) void
(package private) void
jobSuccessful
(String identifier) (package private) void
scheduleRevalidation
(String cacheKey, Runnable command) Schedules an asynchronous re-validationwrap
(ScheduledExecutorService executorService)
-
Field Details
-
scheduledExecutor
-
schedulingStrategy
-
pendingRequest
-
failureCache
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Details
-
CacheRevalidatorBase
public CacheRevalidatorBase(CacheRevalidatorBase.ScheduledExecutor scheduledExecutor, SchedulingStrategy schedulingStrategy) Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategy
andCacheRevalidatorBase.ScheduledExecutor
. -
CacheRevalidatorBase
public CacheRevalidatorBase(ScheduledThreadPoolExecutor scheduledThreadPoolExecutor, SchedulingStrategy schedulingStrategy) Create CacheValidator which will make ache revalidation requests using the suppliedSchedulingStrategy
andScheduledThreadPoolExecutor
.
-
-
Method Details
-
wrap
-
scheduleRevalidation
Schedules an asynchronous re-validation -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
awaitTermination
- Throws:
InterruptedException
-
jobSuccessful
-
jobFailed
-
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
-