I - The input type for the stepO - The output type for the steppublic class JsrChunkProcessor<I,O> extends java.lang.Object implements ChunkProcessor<I>
ChunkProcessor implementation that implements JSR-352's chunking pattern
(read and process in a loop until the chunk is complete then write). This
implementation is responsible for all three phases of chunk based processing
(reading, processing and writing).| Constructor and Description |
|---|
JsrChunkProcessor() |
JsrChunkProcessor(ItemReader<? extends I> reader,
ItemProcessor<? super I,? extends O> processor,
ItemWriter<? super O> writer,
RepeatOperations repeatTemplate) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doPersist(StepContribution contribution,
Chunk<O> chunk)
Implements writing and all related listener calls
|
protected I |
doProvide(StepContribution contribution,
Chunk<I> chunk)
Implements reading as well as any related listener calls required.
|
protected O |
doTransform(I item)
Implements processing and all related listener calls.
|
protected MulticasterBatchListener<I,O> |
getListener() |
protected void |
persist(StepContribution contribution,
Chunk<O> chunk)
Responsible for the writing portion of the chunking loop.
|
void |
process(StepContribution contribution,
Chunk<I> chunk)
Loops through reading (via
provide(StepContribution, Chunk) and
processing (via transform(StepContribution, Object)) until the chunk
is complete. |
protected I |
provide(StepContribution contribution,
Chunk<I> chunk)
Responsible for the reading portion of the chunking loop.
|
void |
registerListener(StepListener listener)
Register a listener for callbacks at the appropriate stages in a process.
|
void |
setListeners(java.util.List<? extends StepListener> listeners)
Register some
StepListeners with the handler. |
protected O |
transform(StepContribution contribution,
I item)
Responsible for the processing portion of the chunking loop.
|
public JsrChunkProcessor()
public JsrChunkProcessor(ItemReader<? extends I> reader, ItemProcessor<? super I,? extends O> processor, ItemWriter<? super O> writer, RepeatOperations repeatTemplate)
protected MulticasterBatchListener<I,O> getListener()
public void process(StepContribution contribution, Chunk<I> chunk) throws java.lang.Exception
provide(StepContribution, Chunk) and
processing (via transform(StepContribution, Object)) until the chunk
is complete. Once the chunk is complete, the results are written (via
persist(StepContribution, Chunk).process in interface ChunkProcessor<I>contribution - a StepContributionchunk - a Chunkjava.lang.ExceptionChunkProcessor.process(StepContribution, Chunk)public void setListeners(java.util.List<? extends StepListener> listeners)
StepListeners with the handler. Each will get the
callbacks in the order specified at the correct stage.listeners - list of listeners to be used within this steppublic void registerListener(StepListener listener)
listener - a StepListenerprotected I provide(StepContribution contribution, Chunk<I> chunk) throws java.lang.Exception
doProvide(StepContribution, Chunk)contribution - a StepContributionchunk - a Chunkjava.lang.Exceptionprotected final I doProvide(StepContribution contribution, Chunk<I> chunk) throws java.lang.Exception
contribution - a StepContributionchunk - a Chunkjava.lang.Exceptionprotected O transform(StepContribution contribution, I item) throws java.lang.Exception
doTransform(Object) if a processor is available (returns the item unmodified if it is not)contribution - a StepContributionitem - an itemjava.lang.Exceptionprotected final O doTransform(I item) throws java.lang.Exception
item - the item to be processedjava.lang.Exceptionprotected void persist(StepContribution contribution, Chunk<O> chunk) throws java.lang.Exception
doPersist(StepContribution, Chunk).contribution - a StepContributionchunk - a Chunkjava.lang.Exceptionprotected final void doPersist(StepContribution contribution, Chunk<O> chunk) throws java.lang.Exception
contribution - a StepContributionchunk - a Chunkjava.lang.Exception