org.springframework.batch.core.step.item
Class ChunkOrientedTasklet<I>

java.lang.Object
  extended by org.springframework.batch.core.step.item.ChunkOrientedTasklet<I>
Type Parameters:
I - input item type
All Implemented Interfaces:
Tasklet

public class ChunkOrientedTasklet<I>
extends Object
implements Tasklet

A Tasklet implementing variations on read-process-write item handling.

Author:
Dave Syer

Constructor Summary
ChunkOrientedTasklet(ChunkProvider<I> chunkProvider, ChunkProcessor<I> chunkProcessor)
           
 
Method Summary
 RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
          Given the current context in the form of a step contribution, do whatever is necessary to process this unit inside a transaction.
 void setBuffering(boolean buffering)
          Flag to indicate that items should be buffered once read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkOrientedTasklet

public ChunkOrientedTasklet(ChunkProvider<I> chunkProvider,
                            ChunkProcessor<I> chunkProcessor)
Method Detail

setBuffering

public void setBuffering(boolean buffering)
Flag to indicate that items should be buffered once read. Defaults to true, which is appropriate for forward-only, non-transactional item readers. Main (or only) use case for setting this flag to false is a transactional JMS item reader.

Parameters:
buffering -

execute

public RepeatStatus execute(StepContribution contribution,
                            ChunkContext chunkContext)
                     throws Exception
Description copied from interface: Tasklet
Given the current context in the form of a step contribution, do whatever is necessary to process this unit inside a transaction. Implementations return RepeatStatus.FINISHED if finished. If not they return RepeatStatus.CONTINUABLE. On failure throws an exception.

Specified by:
execute in interface Tasklet
Parameters:
contribution - mutable state to be passed back to update the current step execution
chunkContext - attributes shared between invocations but not between restarts
Returns:
an RepeatStatus indicating whether processing is continuable.
Throws:
Exception


Copyright © 2013 SpringSource. All Rights Reserved.