Package org.cache2k.io
Interface LoadExceptionInfo<K,V>
-
- All Superinterfaces:
CacheEntry<K,V>,DataAware<K,V>
public interface LoadExceptionInfo<K,V> extends CacheEntry<K,V>
Relevant information of a load attempt that generated an exception. This is used by the exception propagator and the resilience policy.Compatibility: This interface is not intended for implementation or extension by a client and may get additional methods in a new minor release.
Rationale: The information does not contain the time of the original expiry of the cache value. This is intentional. There is no information field to record the time of expiry past the expiry itself. The expiry time information is reset as soon as the expiry time is reached. To produce no overhead, the information provided by this interface is captured only in case an exception happens.
- Since:
- 2
- Author:
- Jens Wilke
- See Also:
ExceptionPropagator,ResiliencePolicy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RuntimeExceptiongenerateExceptionToPropagate()Generate the exception to propagate with the exception propagator@NonNull ThrowablegetException()The original exception generated by the last recent loader call.default LoadExceptionInfo<K,V>getExceptionInfo()Returns ourselves.ExceptionPropagator<K,V>getExceptionPropagator()The exception propagator in effect.KgetKey()The key of the entry.longgetLoadTime()Start time of the load operation that generated the recent exception.intgetRetryCount()Number of retry attempts to load the value for the requested key.longgetSinceTime()Start time of the load that generated the first exception.longgetUntil()Time in millis until the next retry attempt.default VgetValue()Always throws exception based on exception propagator semantics.
-
-
-
Method Detail
-
getKey
K getKey()
The key of the entry. Inherited fromCacheEntry- Specified by:
getKeyin interfaceCacheEntry<K,V>
-
getValue
default V getValue()
Always throws exception based on exception propagator semantics. Inherited fromCacheEntry- Specified by:
getValuein interfaceCacheEntry<K,V>
-
getException
@NonNull @NonNull Throwable getException()
The original exception generated by the last recent loader call. Inherited fromCacheEntry- Specified by:
getExceptionin interfaceCacheEntry<K,V>
-
getExceptionInfo
default LoadExceptionInfo<K,V> getExceptionInfo()
Returns ourselves. Useful because this implementsCacheEntry- Specified by:
getExceptionInfoin interfaceCacheEntry<K,V>
-
generateExceptionToPropagate
default RuntimeException generateExceptionToPropagate()
Generate the exception to propagate with the exception propagator
-
getExceptionPropagator
ExceptionPropagator<K,V> getExceptionPropagator()
The exception propagator in effect.
-
getRetryCount
int getRetryCount()
Number of retry attempts to load the value for the requested key. The value is starting 0 for the first load attempt that yields an exception. The counter is incremented for each consecutive loader exception. After a successful attempt to load the value is reset.- Returns:
- counter starting at 0 for the first load attempt that yields an exception.
-
getSinceTime
long getSinceTime()
Start time of the load that generated the first exception.- Returns:
- Time in millis since epoch or as defined by
TimeReference.
-
getLoadTime
long getLoadTime()
Start time of the load operation that generated the recent exception.- Returns:
- Time in millis since epoch or as defined by
TimeReference.
-
getUntil
long getUntil()
Time in millis until the next retry attempt. This property is only set in the context of theExceptionPropagator.- Returns:
- Time in millis since epoch or as defined by
TimeReference.
-
-