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

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

Introduction

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

Prototype

RepeatContext getParent();

Source Link

Document

If batches are nested, then the inner batch will be created with the outer one as a parent.

Usage

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

/**
 * Get the parent context (the retry is in an inner "chunk" loop and we want
 * the exception to be handled at the outer "step" level).
 * @return the {@link RepeatContext} that should hold the exhausted flag.
 *//*  w w  w .  ja v a  2 s  . c om*/
private RepeatContext getRepeatContext() {
    RepeatContext context = RepeatSynchronizationManager.getContext();
    if (context.getParent() != null) {
        return context.getParent();
    }
    return context;
}

From source file:org.springframework.batch.repeat.support.RepeatTemplate.java

private boolean isMarkedComplete(RepeatContext context) {
    boolean complete = context.isCompleteOnly();
    if (context.getParent() != null) {
        complete = complete || isMarkedComplete(context.getParent());
    }/*from   w w  w . j  ava 2s.  c  o  m*/
    if (complete) {
        logger.debug("Repeat is complete according to context alone.");
    }
    return complete;

}