public class LoggingCacheErrorHandler extends Object implements CacheErrorHandler
CacheErrorHandler implementation that logs error message. Can be
used when underlying cache errors should be ignored.| Constructor and Description |
|---|
LoggingCacheErrorHandler()
Create an instance that does not log stack traces.
|
LoggingCacheErrorHandler(Log logger,
boolean logStacktrace)
Create an instance with the
logger to use. |
| Modifier and Type | Method and Description |
|---|---|
void |
handleCacheClearError(RuntimeException exception,
Cache cache)
Handle the given runtime exception thrown by the cache provider when
clearing the specified
Cache, possibly rethrowing it as a
fatal exception. |
void |
handleCacheEvictError(RuntimeException exception,
Cache cache,
Object key)
Handle the given runtime exception thrown by the cache provider when
clearing an item with the specified
key, possibly rethrowing
it as a fatal exception. |
void |
handleCacheGetError(RuntimeException exception,
Cache cache,
Object key)
Handle the given runtime exception thrown by the cache provider when
retrieving an item with the specified
key, possibly
rethrowing it as a fatal exception. |
void |
handleCachePutError(RuntimeException exception,
Cache cache,
Object key,
Object value)
Handle the given runtime exception thrown by the cache provider when
updating an item with the specified
key and value,
possibly rethrowing it as a fatal exception. |
protected void |
logCacheError(Log logger,
String message,
RuntimeException ex)
Log the specified message.
|
public LoggingCacheErrorHandler(Log logger, boolean logStacktrace)
logger to use.logger - the logger to uselogStacktrace - whether to log stack tracepublic LoggingCacheErrorHandler()
public void handleCacheGetError(RuntimeException exception, Cache cache, Object key)
CacheErrorHandlerkey, possibly
rethrowing it as a fatal exception.handleCacheGetError in interface CacheErrorHandlerexception - the exception thrown by the cache providercache - the cachekey - the key used to get the itemCache.get(Object)public void handleCachePutError(RuntimeException exception, Cache cache, Object key, @Nullable Object value)
CacheErrorHandlerkey and value,
possibly rethrowing it as a fatal exception.handleCachePutError in interface CacheErrorHandlerexception - the exception thrown by the cache providercache - the cachekey - the key used to update the itemvalue - the value to associate with the keyCache.put(Object, Object)public void handleCacheEvictError(RuntimeException exception, Cache cache, Object key)
CacheErrorHandlerkey, possibly rethrowing
it as a fatal exception.handleCacheEvictError in interface CacheErrorHandlerexception - the exception thrown by the cache providercache - the cachekey - the key used to clear the itempublic void handleCacheClearError(RuntimeException exception, Cache cache)
CacheErrorHandlerCache, possibly rethrowing it as a
fatal exception.handleCacheClearError in interface CacheErrorHandlerexception - the exception thrown by the cache providercache - the cache to clearprotected void logCacheError(Log logger, String message, RuntimeException ex)
logger - the loggermessage - the messageex - the exception