org.springframework.batch.core.step.item
Class DefaultItemFailureHandler

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

public class DefaultItemFailureHandler
extends ItemListenerSupport

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

Field Summary
protected static org.apache.commons.logging.Log logger
           
 
Constructor Summary
DefaultItemFailureHandler()
           
 
Method Summary
 void onReadError(Exception ex)
          Called if an error occurs while trying to read.
 void onWriteError(Exception ex, Object item)
          Called if an error occurs while trying to write.
 
Methods inherited from class org.springframework.batch.core.listener.ItemListenerSupport
afterRead, afterWrite, beforeRead, beforeWrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.commons.logging.Log logger
Constructor Detail

DefaultItemFailureHandler

public DefaultItemFailureHandler()
Method Detail

onReadError

public void onReadError(Exception ex)
Description copied from interface: ItemReadListener
Called if an error occurs while trying to read.

Specified by:
onReadError in interface ItemReadListener
Overrides:
onReadError in class ItemListenerSupport
Parameters:
ex - thrown from ItemWriter

onWriteError

public void onWriteError(Exception ex,
                         Object item)
Description copied from interface: ItemWriteListener
Called if an error occurs while trying to write.

Specified by:
onWriteError in interface ItemWriteListener
Overrides:
onWriteError in class ItemListenerSupport
Parameters:
ex - thrown from ItemWriter
item - attempted to be written.


Copyright © 2009 SpringSource. All Rights Reserved.