Example usage for org.springframework.batch.repeat RepeatContext hasAttribute

List of usage examples for org.springframework.batch.repeat RepeatContext hasAttribute

Introduction

In this page you can find the example usage for org.springframework.batch.repeat RepeatContext hasAttribute.

Prototype

boolean hasAttribute(String name);

Source Link

Document

Return true if the attribute identified by name exists.

Usage

From source file:org.springframework.batch.core.step.item.SimpleRetryExceptionHandler.java

/**
 * Check if the exception is going to be retried, and veto the handling if
 * it is. If retry is exhausted or the exception is on the fatal list, then
 * handle using the delegate.// www .  ja  va 2 s .  com
 *
 * @see ExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext,
 * java.lang.Throwable)
 */
@Override
public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
    // Only bother to check the delegate exception handler if we know that
    // retry is exhausted
    if (fatalExceptionClassifier.classify(throwable) || context.hasAttribute(EXHAUSTED)) {
        logger.debug("Handled fatal exception");
        exceptionHandler.handleException(context, throwable);
    } else {
        logger.debug("Handled non-fatal exception", throwable);
    }
}