Class DefaultItemFailureHandler

java.lang.Object
org.springframework.batch.core.listener.ItemListenerSupport<Object,Object>
org.springframework.batch.core.step.item.DefaultItemFailureHandler
All Implemented Interfaces:
ItemProcessListener<Object,Object>, ItemReadListener<Object>, ItemWriteListener<Object>, StepListener

public class DefaultItemFailureHandler extends ItemListenerSupport<Object,Object>
Default implementation of the ItemListenerSupport class that writes all exceptions via commons logging. Since generics can't be used to ensure the list contains exceptions, any non exceptions will be logged out by calling toString on the object.
Author:
Lucas Ward, Mahmoud Ben Hassine
  • Field Details

    • logger

      protected static final org.apache.commons.logging.Log logger
  • Constructor Details

    • DefaultItemFailureHandler

      public DefaultItemFailureHandler()
  • Method Details

    • onReadError

      public void onReadError(Exception ex)
      Description copied from interface: ItemReadListener
      Called if an error occurs while trying to read.
      Parameters:
      ex - thrown from ItemReader
    • onWriteError

      public void onWriteError(Exception ex, Chunk<?> item)
      Description copied from interface: ItemWriteListener
      Called if an error occurs while trying to write. Called inside a transaction, but the transaction will normally be rolled back. There is no way to identify from this callback which of the items (if any) caused the error.
      Parameters:
      ex - thrown from ItemWriter
      item - attempted to be written.