Package org.cache2k.core
Class ExceptionWrapper<K,V>
- java.lang.Object
-
- org.cache2k.core.ExceptionWrapper<K,V>
-
- All Implemented Interfaces:
org.cache2k.CacheEntry<K,V>
,org.cache2k.DataAware<K,V>
,org.cache2k.io.LoadExceptionInfo<K,V>
public class ExceptionWrapper<K,V> extends Object implements org.cache2k.io.LoadExceptionInfo<K,V>
The exception wrapper is used in the value field of the entry, in case of an exception. This way we can store exceptions without needing additional memory, if no exceptions happen.The wrapper is immutable and implements cache entry, this way it can be used returned cache entry directly.
- Author:
- Jens Wilke
-
-
Constructor Summary
Constructors Constructor Description ExceptionWrapper(K key, long now, Throwable ex, org.cache2k.io.ExceptionPropagator<K,V> p)
ExceptionWrapper(K key, Throwable exception, long loadTime, Entry e, org.cache2k.io.ExceptionPropagator<K,V> p)
Take over exception information from the entry, which either has no exception, an existing cached exception or a suppressed exception.ExceptionWrapper(K key, Throwable exception, long loadTime, org.cache2k.io.LoadExceptionInfo w, org.cache2k.io.ExceptionPropagator<K,V> p)
ExceptionWrapper(ExceptionWrapper<K,V> w, long until)
Copy constructor to set until.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Throwable
getException()
org.cache2k.io.LoadExceptionInfo<K,V>
getExceptionInfo()
org.cache2k.io.ExceptionPropagator<K,V>
getExceptionPropagator()
K
getKey()
long
getLoadTime()
int
getRetryCount()
long
getSinceTime()
long
getUntil()
String
toString()
The exception wrapper instance is also used asCacheEntry
directly and returned byCache.getEntry(Object)
-
-
-
Constructor Detail
-
ExceptionWrapper
public ExceptionWrapper(ExceptionWrapper<K,V> w, long until)
Copy constructor to set until.
-
ExceptionWrapper
public ExceptionWrapper(K key, long now, Throwable ex, org.cache2k.io.ExceptionPropagator<K,V> p)
-
ExceptionWrapper
public ExceptionWrapper(K key, Throwable exception, long loadTime, Entry e, org.cache2k.io.ExceptionPropagator<K,V> p)
Take over exception information from the entry, which either has no exception, an existing cached exception or a suppressed exception.
-
-
Method Detail
-
getKey
public K getKey()
-
getException
public Throwable getException()
-
getUntil
public long getUntil()
-
getLoadTime
public long getLoadTime()
-
getRetryCount
public int getRetryCount()
-
getSinceTime
public long getSinceTime()
-
-