|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.repeat.exception.LogOrRethrowExceptionHandler
public class LogOrRethrowExceptionHandler
Implementation of ExceptionHandler
based on an ExceptionClassifier
. The classifier determines
whether to log the exception or rethrow it. The keys in the classifier must be the same as the static contants in
this class.
Field Summary | |
---|---|
static String |
DEBUG
Key for ExceptionClassifier signalling that the throwable should be logged at debug level. |
static String |
ERROR
Key for ExceptionClassifier signalling that the throwable should be logged at error level. |
protected org.apache.commons.logging.Log |
logger
|
static String |
RETHROW
Key for ExceptionClassifier signalling that the throwable should be rethrown. |
static String |
WARN
Key for ExceptionClassifier signalling that the throwable should be logged at warn level. |
Constructor Summary | |
---|---|
LogOrRethrowExceptionHandler()
|
Method Summary | |
---|---|
void |
handleException(RepeatContext context,
Throwable throwable)
Classify the throwables and decide whether to rethrow based on the result. |
void |
setExceptionClassifier(ExceptionClassifier exceptionClassifier)
Setter for the ExceptionClassifier used by this handler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String RETHROW
ExceptionClassifier
signalling that the throwable should be rethrown. If the throwable is not a
RuntimeException it is wrapped in a RepeatException
.
public static final String DEBUG
ExceptionClassifier
signalling that the throwable should be logged at debug level.
public static final String WARN
ExceptionClassifier
signalling that the throwable should be logged at warn level.
public static final String ERROR
ExceptionClassifier
signalling that the throwable should be logged at error level.
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public LogOrRethrowExceptionHandler()
Method Detail |
---|
public void setExceptionClassifier(ExceptionClassifier exceptionClassifier)
ExceptionClassifier
used by this handler. The default is to map all throwable instances to
RETHROW
.
exceptionClassifier
- public void handleException(RepeatContext context, Throwable throwable) throws Throwable
handleException
in interface ExceptionHandler
context
- the current RepeatContext
. Can be used to store
state (via attributes), for example to count the number of occurrences of
a particular exception type and implement a threshold policy.throwable
- an exception.
Throwable
ExceptionHandler.handleException(RepeatContext, Throwable)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |