public abstract class AbstractCacheInvoker extends Object
Cache
operations and using a
configurable CacheErrorHandler
when an exception occurs.CacheErrorHandler
Modifier | Constructor and Description |
---|---|
protected |
AbstractCacheInvoker() |
protected |
AbstractCacheInvoker(CacheErrorHandler errorHandler) |
Modifier and Type | Method and Description |
---|---|
protected void |
doClear(Cache cache)
Execute
Cache.clear() on the specified Cache and
invoke the error handler if an exception occurs. |
protected void |
doEvict(Cache cache,
Object key)
Execute
Cache.evict(Object) on the specified Cache and
invoke the error handler if an exception occurs. |
protected Cache.ValueWrapper |
doGet(Cache cache,
Object key)
Execute
Cache.get(Object) on the specified Cache and
invoke the error handler if an exception occurs. |
protected void |
doPut(Cache cache,
Object key,
Object result)
Execute
Cache.put(Object, Object) on the specified Cache
and invoke the error handler if an exception occurs. |
CacheErrorHandler |
getErrorHandler()
Return the
CacheErrorHandler to use. |
void |
setErrorHandler(CacheErrorHandler errorHandler)
Set the
CacheErrorHandler instance to use to handle errors
thrown by the cache provider. |
protected AbstractCacheInvoker()
protected AbstractCacheInvoker(CacheErrorHandler errorHandler)
public void setErrorHandler(CacheErrorHandler errorHandler)
CacheErrorHandler
instance to use to handle errors
thrown by the cache provider. By default, a SimpleCacheErrorHandler
is used who throws any exception as is.public CacheErrorHandler getErrorHandler()
CacheErrorHandler
to use.protected Cache.ValueWrapper doGet(Cache cache, Object key)
Cache.get(Object)
on the specified Cache
and
invoke the error handler if an exception occurs. Return null
if the handler does not throw any exception, which simulates a cache
miss in case of error.Cache.get(Object)
protected void doPut(Cache cache, Object key, Object result)
Cache.put(Object, Object)
on the specified Cache
and invoke the error handler if an exception occurs.protected void doEvict(Cache cache, Object key)
Cache.evict(Object)
on the specified Cache
and
invoke the error handler if an exception occurs.protected void doClear(Cache cache)
Cache.clear()
on the specified Cache
and
invoke the error handler if an exception occurs.