Example usage for org.springframework.batch.core.step.item Chunk isEnd

List of usage examples for org.springframework.batch.core.step.item Chunk isEnd

Introduction

In this page you can find the example usage for org.springframework.batch.core.step.item Chunk isEnd.

Prototype

public boolean isEnd() 

Source Link

Document

Flag to indicate if the source data is exhausted.

Usage

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

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {

    @SuppressWarnings("unchecked")
    Chunk<I> inputs = (Chunk<I>) chunkContext.getAttribute(INPUTS_KEY);
    if (inputs == null) {
        inputs = chunkProvider.provide(contribution);
        if (buffering) {
            chunkContext.setAttribute(INPUTS_KEY, inputs);
        }//  w  ww . ja  va  2 s  .c o  m
    }

    chunkProcessor.process(contribution, inputs);
    chunkProvider.postProcess(contribution, inputs);

    // Allow a message coming back from the processor to say that we
    // are not done yet
    if (inputs.isBusy()) {
        logger.debug("Inputs still busy");
        return RepeatStatus.CONTINUABLE;
    }

    chunkContext.removeAttribute(INPUTS_KEY);
    chunkContext.setComplete();

    if (logger.isDebugEnabled()) {
        logger.debug("Inputs not busy, ended: " + inputs.isEnd());
    }
    return RepeatStatus.continueIf(!inputs.isEnd());

}