public abstract class ResiliencePolicy<K,V> extends Object implements ExpiryTimeValues
| Modifier and Type | Class and Description |
|---|---|
static interface |
ResiliencePolicy.Context
Provides additional context information.
|
| Constructor and Description |
|---|
ResiliencePolicy() |
| Modifier and Type | Method and Description |
|---|---|
void |
init(ResiliencePolicy.Context context)
Called before any other call.
|
abstract long |
retryLoadAfter(K key,
ExceptionInformation exceptionInformation)
Called after the loader threw an exception and no previous value is available or
suppressExceptionUntil(K, org.cache2k.integration.ExceptionInformation, org.cache2k.CacheEntry<K, V>) returned zero. |
abstract long |
suppressExceptionUntil(K key,
ExceptionInformation exceptionInformation,
CacheEntry<K,V> cachedContent)
Called after the loader threw an exception and a previous value is available.
|
public void init(ResiliencePolicy.Context context)
context - Additional context informationpublic abstract long suppressExceptionUntil(K key, ExceptionInformation exceptionInformation, CacheEntry<K,V> cachedContent)
The returned value is a point in time. If the currently cached content is expired, returning a future time will effectively extend the entry expiry.
Returning 0 or a past time means the exception should not be suppressed.
The cache will call immediately retryLoadAfter(K, org.cache2k.integration.ExceptionInformation) to determine how long the
exception should stay in the cache and when the next retry attempt takes place.
If the exception is not suppressed, it will wrapped into a CacheLoaderException
and propagated to the cache client. This is customizable by the ExceptionPropagator.
cachedContent - The entry representing the currently cached content.
It is possible that this data is already expired.ExpiryTimeValues.ETERNAL means the exception will be
suppressed and the recent content will be returned eternally.
If the returned time is after ExceptionInformation.getLoadTime()
the exception will be suppressed for the ongoing operation.public abstract long retryLoadAfter(K key, ExceptionInformation exceptionInformation)
suppressExceptionUntil(K, org.cache2k.integration.ExceptionInformation, org.cache2k.CacheEntry<K, V>) returned zero.cache2k API documentation. Copyright © 2000–2019 headissue GmbH, Munich.