org.springframework.batch.core.jsr.step.item

## Class JsrFaultTolerantChunkProcessor<I,O>

- java.lang.Object
- - org.springframework.batch.core.jsr.step.item.JsrChunkProcessor<I,O>
  - - org.springframework.batch.core.jsr.step.item.JsrFaultTolerantChunkProcessor<I,O>

- Type Parameters:
    `I` - input type for the step
    `O` - output type for the step
  All Implemented Interfaces:
    ChunkProcessor<I>

      public class JsrFaultTolerantChunkProcessor<I,O>
      extends JsrChunkProcessor<I,O>

  Extension of the `JsrChunkProcessor` that adds skip and retry functionality.
  Author:
    Michael Minella, Chris Schaefer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.commons.logging.Log` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsrFaultTolerantChunkProcessor(ItemReader<? extends I> reader, ItemProcessor<? super I,? extends O> processor, ItemWriter<? super O> writer, RepeatOperations repeatTemplate, BatchRetryTemplate batchRetryTemplate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `persist(StepContribution contribution, Chunk<O> chunk)` Adds retry and skip logic to the write phase of the chunk loop.
    `protected I` | `provide(StepContribution contribution, Chunk<I> chunk)` Adds retry and skip logic to the reading phase of the chunk loop.
    `void` | `registerListener(StepListener listener)` Register a listener for callbacks at the appropriate stages in a process.
    `void` | `setChunkMonitor(ChunkMonitor chunkMonitor)`
    `void` | `setListeners(java.util.List<? extends StepListener> listeners)` Register some `StepListener`s with the handler.
    `void` | `setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)`
    `void` | `setSkipPolicy(SkipPolicy skipPolicy)`
    `protected O` | `transform(StepContribution contribution, I item)` Adds retry and skip logic to the process phase of the chunk loop.

    - ### Methods inherited from class org.springframework.batch.core.jsr.step.item.JsrChunkProcessor

      `doPersist, doProvide, doTransform, getListener, process`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected final org.apache.commons.logging.Log logger

  - ### Constructor Detail

    - #### JsrFaultTolerantChunkProcessor

          public JsrFaultTolerantChunkProcessor(ItemReader<? extends I> reader,
                                                ItemProcessor<? super I,? extends O> processor,
                                                ItemWriter<? super O> writer,
                                                RepeatOperations repeatTemplate,
                                                BatchRetryTemplate batchRetryTemplate)

  - ### Method Detail

    - #### setSkipPolicy

          public void setSkipPolicy(SkipPolicy skipPolicy)

      Parameters:
        `skipPolicy` - a `SkipPolicy`

    - #### setRollbackClassifier

          public void setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)

      Parameters:
        `rollbackClassifier` - a `Classifier`

    - #### setChunkMonitor

          public void setChunkMonitor(ChunkMonitor chunkMonitor)

      Parameters:
        `chunkMonitor` - a `ChunkMonitor`

    - #### setListeners

          public void setListeners(java.util.List<? extends StepListener> listeners)

      Register some `StepListener`s with the handler. Each will get the callbacks in the order specified at the correct stage.
      Overrides:
        `setListeners` in class `JsrChunkProcessor<I,O>`
      Parameters:
        `listeners` - listeners to be registered

    - #### registerListener

          public void registerListener(StepListener listener)

      Register a listener for callbacks at the appropriate stages in a process.
      Overrides:
        `registerListener` in class `JsrChunkProcessor<I,O>`
      Parameters:
        `listener` - a `StepListener`

    - #### provide

          protected I provide(StepContribution contribution,
                              Chunk<I> chunk)
                       throws java.lang.Exception

      Adds retry and skip logic to the reading phase of the chunk loop.
      Overrides:
        `provide` in class `JsrChunkProcessor<I,O>`
      Parameters:
        `contribution` - a `StepContribution`
        `chunk` - a `Chunk`
      Returns:
        I an item
      Throws:
        `java.lang.Exception`

    - #### transform

          protected O transform(StepContribution contribution,
                                I item)
                         throws java.lang.Exception

      Adds retry and skip logic to the process phase of the chunk loop.
      Overrides:
        `transform` in class `JsrChunkProcessor<I,O>`
      Parameters:
        `contribution` - a `StepContribution`
        `item` - an item to be processed
      Returns:
        O an item that has been processed if a processor is available
      Throws:
        `java.lang.Exception`

    - #### persist

          protected void persist(StepContribution contribution,
                                 Chunk<O> chunk)
                          throws java.lang.Exception

      Adds retry and skip logic to the write phase of the chunk loop.
      Overrides:
        `persist` in class `JsrChunkProcessor<I,O>`
      Parameters:
        `contribution` - a `StepContribution`
        `chunk` - a `Chunk`
      Throws:
        `java.lang.Exception`