Class StepListenerSupport<T,​S>

    • Constructor Detail

      • StepListenerSupport

        public StepListenerSupport()
    • Method Detail

      • afterStep

        public ExitStatus afterStep​(StepExecution stepExecution)
        Description copied from interface: StepExecutionListener
        Give a listener a chance to modify the exit status from a step. The value returned will be combined with the normal exit status using ExitStatus.and(ExitStatus). Called after execution of step's processing logic (both successful or failed). Throwing exception in this method has no effect, it will only be logged.
        Specified by:
        afterStep in interface StepExecutionListener
        Parameters:
        stepExecution - StepExecution instance.
        Returns:
        an ExitStatus to combine with the normal value. Return null to leave the old value unchanged.
      • afterRead

        public void afterRead​(T item)
        Description copied from interface: ItemReadListener
        Called after ItemReader.read(). This method is called only for actual items (ie it is not called when the reader returns null).
        Specified by:
        afterRead in interface ItemReadListener<T>
        Parameters:
        item - returned from read()
      • onWriteError

        public void onWriteError​(java.lang.Exception exception,
                                 java.util.List<? extends S> items)
        Description copied from interface: ItemWriteListener
        Called if an error occurs while trying to write. Will be 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.
        Specified by:
        onWriteError in interface ItemWriteListener<T>
        Parameters:
        exception - thrown from ItemWriter
        items - attempted to be written.
      • afterProcess

        public void afterProcess​(T item,
                                 @Nullable
                                 S result)
        Description copied from interface: ItemProcessListener
        Called after ItemProcessor.process(Object) returns. If the processor returns null, this method will still be called, with a {code null} result, allowing for notification of 'filtered' items.
        Specified by:
        afterProcess in interface ItemProcessListener<T,​S>
        Parameters:
        item - to be processed
        result - of processing
      • onSkipInProcess

        public void onSkipInProcess​(T item,
                                    java.lang.Throwable t)
        Description copied from interface: SkipListener
        This item failed on processing with the given exception, and a skip was called for.
        Specified by:
        onSkipInProcess in interface SkipListener<T,​S>
        Parameters:
        item - the failed item
        t - the cause of the failure
      • onSkipInRead

        public void onSkipInRead​(java.lang.Throwable t)
        Description copied from interface: SkipListener
        Callback for a failure on read that is legal, so is not going to be re-thrown. In case transaction is rolled back and items are re-read, this callback will occur repeatedly for the same cause. This will only happen if read items are not buffered.
        Specified by:
        onSkipInRead in interface SkipListener<T,​S>
        Parameters:
        t - cause of the failure
      • onSkipInWrite

        public void onSkipInWrite​(S item,
                                  java.lang.Throwable t)
        Description copied from interface: SkipListener
        This item failed on write with the given exception, and a skip was called for.
        Specified by:
        onSkipInWrite in interface SkipListener<T,​S>
        Parameters:
        item - the failed item
        t - the cause of the failure
      • afterChunkError

        public void afterChunkError​(ChunkContext context)
        Description copied from interface: ChunkListener
        Callback after a chunk has been marked for rollback. It is invoked after transaction rollback. While the rollback will have occurred, transactional resources might still be active and accessible. Due to this, data access code within this callback will still "participate" in the original transaction unless it declares that it runs in its own transaction. Hence: Use PROPAGATION_REQUIRES_NEW for any transactional operation that is called from here.
        Specified by:
        afterChunkError in interface ChunkListener
        Parameters:
        context - the chunk context containing the exception that caused the underlying rollback.