Example usage for org.springframework.batch.core.step.skip SkipListenerFailedException SkipListenerFailedException

List of usage examples for org.springframework.batch.core.step.skip SkipListenerFailedException SkipListenerFailedException

Introduction

In this page you can find the example usage for org.springframework.batch.core.step.skip SkipListenerFailedException SkipListenerFailedException.

Prototype

public SkipListenerFailedException(String message, RuntimeException ex, Throwable t) 

Source Link

Usage

From source file:org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.java

private void callSkipListeners(final Chunk<I> inputs, final Chunk<O> outputs) {

    for (SkipWrapper<I> wrapper : inputs.getSkips()) {
        I item = wrapper.getItem();// w  ww. j a v  a 2s .c  o  m
        if (item == null) {
            continue;
        }
        Throwable e = wrapper.getException();
        callProcessSkipListener(item, e);
    }

    for (SkipWrapper<O> wrapper : outputs.getSkips()) {
        Throwable e = wrapper.getException();
        try {
            getListener().onSkipInWrite(wrapper.getItem(), e);
        } catch (RuntimeException ex) {
            throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e);
        }
    }

    // Clear skips if we are possibly going to process this chunk again
    outputs.clearSkips();
    inputs.clearSkips();

}

From source file:org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.java

/**
 * Convenience method for calling process skip listener, so that it can be
 * called from multiple places.//from  w  ww  .j  a  v a 2  s  .  c  om
 *
 * @param item the item that is skipped
 * @param e the cause of the skip
 */
private void callProcessSkipListener(I item, Throwable e) {
    try {
        getListener().onSkipInProcess(item, e);
    } catch (RuntimeException ex) {
        throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e);
    }
}

From source file:org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.java

/**
 * Convenience method for calling process skip policy, so that it can be
 * called from multiple places./*from  ww  w  .j  a  v a 2 s .  c o m*/
 *
 * @param policy the skip policy
 * @param e the cause of the skip
 * @param skipCount the current skip count
 */
private boolean shouldSkip(SkipPolicy policy, Throwable e, int skipCount) {
    try {
        return policy.shouldSkip(e, skipCount);
    } catch (SkipLimitExceededException ex) {
        throw ex;
    } catch (RuntimeException ex) {
        throw new SkipListenerFailedException("Fatal exception in SkipPolicy.", ex, e);
    }
}