@Override public void postProcess(StepContribution contribution, Chunk<I> chunk) { for (Exception e : chunk.getErrors()) { try { getListener().onSkipInRead(e); } catch (RuntimeException ex) { throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e); } } }
/** * Test method for * {@link org.springframework.batch.core.listener.MulticasterBatchListener#onSkipInRead(java.lang.Throwable)} * . */ @Test public void testOnSkipInRead() { multicast.register(new SkipListenerSupport<Object,Object>() { @Override public void onSkipInRead(Throwable t) { count++; super.onSkipInRead(t); } }); multicast.onSkipInRead(new RuntimeException("foo")); assertEquals(1, count); }
/** * Test method for * {@link org.springframework.batch.core.listener.MulticasterBatchListener#onSkipInRead(java.lang.Throwable)} * . */ @Test public void testOnSkipInReadFails() { multicast.register(new SkipListenerSupport<Object,Object>() { @Override public void onSkipInRead(Throwable t) { count++; throw new RuntimeException("foo"); } }); try { multicast.onSkipInRead(new RuntimeException("bar")); fail("Expected RuntimeException"); } catch (RuntimeException e) { // expected String message = e.getMessage(); assertEquals("Wrong message: " + message, "foo", message); } assertEquals(1, count); }
@Override public I doWithRetry(RetryContext arg0) throws Exception { while (true) { try { return doProvide(contribution, chunk); } catch (Exception e) { if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { // increment skip count and try again contribution.incrementReadSkipCount(); chunk.skip(e); getListener().onSkipInRead(e); logger.debug("Skipping failed input", e); } else { getListener().onRetryReadException(e); if(rollbackClassifier.classify(e)) { throw e; } else { throw e; } } } } } };
@Override public void postProcess(StepContribution contribution, Chunk<I> chunk) { for (Exception e : chunk.getErrors()) { try { getListener().onSkipInRead(e); } catch (RuntimeException ex) { throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e); } } }
@Override public void postProcess(StepContribution contribution, Chunk<I> chunk) { for (Exception e : chunk.getErrors()) { try { getListener().onSkipInRead(e); } catch (RuntimeException ex) { throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e); } } }
@Override public void postProcess(StepContribution contribution, Chunk<I> chunk) { for (Exception e : chunk.getErrors()) { try { getListener().onSkipInRead(e); } catch (RuntimeException ex) { throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e); } } }
@Override public void postProcess(StepContribution contribution, Chunk<I> chunk) { for (Exception e : chunk.getErrors()) { try { getListener().onSkipInRead(e); } catch (RuntimeException ex) { throw new SkipListenerFailedException("Fatal exception in SkipListener.", ex, e); } } }
@Override public I doWithRetry(RetryContext arg0) throws Exception { while (true) { try { return doProvide(contribution, chunk); } catch (Exception e) { if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { // increment skip count and try again contribution.incrementReadSkipCount(); chunk.skip(e); getListener().onSkipInRead(e); logger.debug("Skipping failed input", e); } else { getListener().onRetryReadException(e); if(rollbackClassifier.classify(e)) { throw e; } else { throw e; } } } } } };
@Override public I doWithRetry(RetryContext arg0) throws Exception { while (true) { try { return doProvide(contribution, chunk); } catch (Exception e) { if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { // increment skip count and try again contribution.incrementReadSkipCount(); chunk.skip(e); getListener().onSkipInRead(e); logger.debug("Skipping failed input", e); } else { getListener().onRetryReadException(e); if(rollbackClassifier.classify(e)) { throw e; } else { throw e; } } } } } };
@Override public I doWithRetry(RetryContext arg0) throws Exception { while (true) { try { return doProvide(contribution, chunk); } catch (Exception e) { if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { // increment skip count and try again contribution.incrementReadSkipCount(); chunk.skip(e); getListener().onSkipInRead(e); logger.debug("Skipping failed input", e); } else { getListener().onRetryReadException(e); if(rollbackClassifier.classify(e)) { throw e; } else { throw e; } } } } } };