@Override public void afterChunkError(ChunkContext context) { if(context != null) { try { delegate.onError((Exception) context.getAttribute(ChunkListener.ROLLBACK_EXCEPTION_KEY)); } catch (Exception e) { throw new UncheckedTransactionException(e); } } else { throw new BatchRuntimeException("Unable to retrieve causing exception due to null ChunkContext"); } } }
@Test public void testAfterChunkError() throws Exception { Exception exception = new Exception("This was expected"); when(context.getAttribute(org.springframework.batch.core.ChunkListener.ROLLBACK_EXCEPTION_KEY)).thenReturn(exception); adapter.afterChunkError(context); verify(delegate).onError(exception); } }
@Override public void onError(Exception ex) throws Exception { try { this.delegate.onError(ex); } catch (Exception e) { this.stepContext.setException(e); throw new BatchContainerRuntimeException(e); } }
@Override public void onError(Exception ex) throws Exception { try { this.delegate.onError(ex); } catch (Exception e) { this.stepContext.setException(e); throw new BatchContainerRuntimeException(e); } }
@Override public void onError(Exception ex) throws Exception { try { this.delegate.onError(ex); } catch (Exception e) { this.stepContext.setException(e); throw new BatchContainerRuntimeException(e); } }
private void rollbackAfterRetryableException() throws Exception { doClose(); for (ChunkListener chunkProxy : chunkListeners) { try { chunkProxy.onError(currentChunkStatus.getRetryableException()); } catch (final Exception e1) { logger.log(Level.SEVERE, e1.getMessage(), e1); } } transactionManager.rollback(); stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); }
@Override public void afterChunkError(ChunkContext context) { if(context != null) { try { delegate.onError((Exception) context.getAttribute(ChunkListener.ROLLBACK_EXCEPTION_KEY)); } catch (Exception e) { throw new UncheckedTransactionException(e); } } else { throw new BatchRuntimeException("Unable to retrieve causing exception due to null ChunkContext"); } } }
@Override public void afterChunkError(ChunkContext context) { if(context != null) { try { delegate.onError((Exception) context.getAttribute(ChunkListener.ROLLBACK_EXCEPTION_KEY)); } catch (Exception e) { throw new UncheckedTransactionException(e); } } else { throw new BatchRuntimeException("Unable to retrieve causing exception due to null ChunkContext"); } } }
@Override public void afterChunkError(ChunkContext context) { if(context != null) { try { delegate.onError((Exception) context.getAttribute(ChunkListener.ROLLBACK_EXCEPTION_KEY)); } catch (Exception e) { throw new UncheckedTransactionException(e); } } else { throw new BatchRuntimeException("Unable to retrieve causing exception due to null ChunkContext"); } } }
l.onError(exception);
for (ChunkListener chunkProxy : chunkListeners) { try { chunkProxy.onError(e); } catch (final Exception e1) { logger.log(Level.SEVERE, e1.getMessage(), e1);
chunkProxy.onError(e); } catch (final Exception e1) { logger.log(Level.SEVERE, e1.getMessage(), e1);