Top Description Methods
net.sf.ehcache.exceptionhandler

public Interface CacheExceptionHandler

Imports
net.sf.ehcache.Ehcache

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:

Author
Greg Luck
Version
$Id: CacheExceptionHandler.java 10789 2018-04-26 02:08:13Z adahanne $

Method Summary

Modifier and TypeMethod 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.

Method Detail

onExceptionback 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 Error occurs.

Parameters
ehcache:Ehcache

the cache in which the Exception occurred

key:Object

the key used in the operation, or null if the operation does not use a key or the key was null

exception:Exception

the Exception caught.