List of usage examples for org.springframework.batch.repeat.context RepeatContextCounter getCount
public int getCount()
From source file:org.springframework.batch.repeat.exception.RethrowOnThresholdExceptionHandler.java
/** * Classify the throwables and decide whether to re-throw based on the * result. The context is used to accumulate the number of exceptions of the * same type according to the classifier. * //from www .j a v a 2s. com * @throws Throwable * @see ExceptionHandler#handleException(RepeatContext, Throwable) */ @Override public void handleException(RepeatContext context, Throwable throwable) throws Throwable { IntegerHolder key = exceptionClassifier.classify(throwable); RepeatContextCounter counter = getCounter(context, key); counter.increment(); int count = counter.getCount(); int threshold = key.getValue(); if (count > threshold) { throw throwable; } }