private Object processItem ( Object itemRead ) { logger . entering ( sourceClass , "processItem" , itemRead ) ; Object processedItem = null ; // if no processor defined for this chunk if ( processorProxy == null ) { return itemRead ; } try { // call process listeners before and after the actual process call for ( ItemProcessListenerProxy processListenerProxy : itemProcessListeners ) { processListenerProxy . beforeProcess ( itemRead ) ; } processedItem = processorProxy . processItem ( itemRead ) ; if ( processedItem == null ) { currentItemStatus . setFiltered ( true ) ; } for ( ItemProcessListenerProxy processListenerProxy : itemProcessListeners ) { processListenerProxy . afterProcess ( itemRead , processedItem ) ; } } catch ( Exception e ) { for ( ItemProcessListenerProxy processListenerProxy : itemProcessListeners ) { processListenerProxy . onProcessError ( itemRead , e ) ; } if ( ! currentChunkStatus . isRetryingAfterRollback ( ) ) { if ( retryProcessException ( e , itemRead ) ) { if ( ! retryHandler . isRollbackException ( e ) ) { processedItem = processItem ( itemRead ) ; } else { currentChunkStatus . markForRollbackWithRetry ( e ) ; } } else if ( skipProcessException ( e , itemRead ) ) { currentItemStatus . setSkipped ( true ) ; stepContext . getMetric ( MetricImpl . MetricType . PROCESS_SKIP_COUNT ) . incValue ( ) ; } else { throw new BatchContainerRuntimeException ( e ) ; } } else { if ( skipProcessException ( e , itemRead ) ) { currentItemStatus . setSkipped ( true ) ; stepContext . getMetric ( MetricImpl . MetricType . PROCESS_SKIP_COUNT ) . incValue ( ) ; } else if ( retryProcessException ( e , itemRead ) ) { if ( ! retryHandler . isRollbackException ( e ) ) { // retry without rollback processedItem = processItem ( itemRead ) ; } else { // retry with rollback currentChunkStatus . markForRollbackWithRetry ( e ) ; } } else { throw new BatchContainerRuntimeException ( e ) ; } } } catch ( Throwable e ) { throw new BatchContainerRuntimeException ( e ) ; } logger . exiting ( sourceClass , "processItem" , processedItem == null ? "<null>" : processedItem ) ; return processedItem ; }
Process an item previously read by the reader