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:
IllegalStateException if the cache is not net.sf.ehcache.Status#STATUS_ALIVE
IllegalArgumentException if an attempt is made to put a null element into a cache
net.sf.ehcache.distribution.RemoteCacheException if an issue occurs in remote synchronous replication
| Modifier and Type | Method and Description |
|---|---|
| public void | onException(Ehcache
the cache in which the Exception occurred ehcache, Object the key used in the operation, or null if the operation does not use a key or the key was null key, Exception the Exception caught. exception)Called if an Exception occurs in a Cache method. |
| onException | back to summary |
|---|---|
| public void onException(Ehcache ehcache, Object key, Exception exception) Called if an Exception occurs in a Cache method. This method is not called
if an | |