net.sf.ehcache.exceptionhandler
Interface CacheExceptionHandler
public interface CacheExceptionHandler
A handler which may be registered with an Ehcache, to handle exceptions on Cache operations.
Handlers may be registered at configuration time in ehcache.xml, using a CacheExceptionHandlerFactory, or
set at runtime (a strategy).
If an exception handler is registered, the default behaviour of throwing the exception will not occur. The handler
method onException
will be called. Of course, if the handler decides to throw the exception, it will
propagate up through the call stack. If the handler does not, it won't.
Some common Exceptions thrown, and which therefore should be considered when implementing this class are listed below:
- Version:
- $Id: CacheExceptionHandler.java 5594 2012-05-07 16:04:31Z cdennis $
- Author:
- Greg Luck
onException
void onException(Ehcache ehcache,
Object key,
Exception exception)
- Called if an Exception occurs in a Cache method. This method is not called
if an
Error
occurs.
- Parameters:
ehcache
- the cache in which the Exception occurredkey
- the key used in the operation, or null if the operation does not use a key or the key was nullexception
- the Exception caught.
Copyright 2001-2016, Terracotta, Inc.