Package net.sf.ehcache.exceptionhandler
Interface CacheExceptionHandler
-
public interface CacheExceptionHandlerA 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
onExceptionwill 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:
IllegalStateExceptionif the cache is notStatus.STATUS_ALIVEIllegalArgumentExceptionif an attempt is made to put a null element into a cacheRemoteCacheExceptionif an issue occurs in remote synchronous replication
- Version:
- $Id$
- Author:
- Greg Luck
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonException(Ehcache ehcache, java.lang.Object key, java.lang.Exception exception)Called if an Exception occurs in a Cache method.
-
-
-
Method Detail
-
onException
void onException(Ehcache ehcache, java.lang.Object key, java.lang.Exception exception)
Called if an Exception occurs in a Cache method. This method is not called if anErroroccurs.- 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.
-
-