Java Examples for org.springframework.batch.retry.RetryException

The following java examples will help you to understand the usage of org.springframework.batch.retry.RetryException. These source code samples are taken from different open source projects.

Example 1
Project: spring-batch-jms-generic-slave-master  File: GenericChunkProcessorChunkHandler.java View source code
/**
	 * @param chunkRequest the current request
	 * @param stepContribution the step contribution to update
	 * @throws Exception if there is a fatal exception
	 */
private Throwable process(MyChunkRequest<S> chunkRequest, StepContribution stepContribution) throws Exception {
    ChunkProcessor<S> chunkProcessor = chunkRequest.getChunkProcessor();
    logger.debug("ChunkProcessor=" + chunkProcessor.getClass());
    Assert.state(chunkProcessor instanceof ChunkProcessor<?>, chunkProcessor.getClass() + "must be a ChunkProcessor");
    Chunk<S> chunk = new Chunk<S>(chunkRequest.getItems());
    Throwable failure = null;
    try {
        chunkProcessor.process(stepContribution, chunk);
    } catch (SkipLimitExceededException e) {
        failure = e;
    } catch (NonSkippableReadException e) {
        failure = e;
    } catch (SkipListenerFailedException e) {
        failure = e;
    } catch (RetryException e) {
        failure = e;
    } catch (JobInterruptedException e) {
        failure = e;
    } catch (Exception e) {
        if (chunkProcessor instanceof FaultTolerantChunkProcessor<?, ?>) {
            throw e;
        } else {
            failure = e;
        }
    }
    return failure;
}