@Override public void afterChunk(ChunkContext context) { try { delegate.afterChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public RepeatStatus doInChunkContext(RepeatContext repeatContext, ChunkContext chunkContext) throws Exception { StepExecution stepExecution = chunkContext.getStepContext().getStepExecution(); // Before starting a new transaction, check for // interruption. interruptionPolicy.checkInterrupted(stepExecution); RepeatStatus result; try { result = new TransactionTemplate(transactionManager, transactionAttribute) .execute(new ChunkTransactionCallback(chunkContext, semaphore)); } catch (UncheckedTransactionException e) { // Allow checked exceptions to be thrown inside callback throw (Exception) e.getCause(); } chunkListener.afterChunk(chunkContext); // Check for interruption after transaction as well, so that // the interrupted exception is correctly propagated up to // caller interruptionPolicy.checkInterrupted(stepExecution); return result == null ? RepeatStatus.FINISHED : result; }
@Override public void beforeChunk(ChunkContext context) { try { delegate.beforeChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public RepeatStatus doInChunkContext(RepeatContext repeatContext, ChunkContext chunkContext) throws Exception { StepExecution stepExecution = chunkContext.getStepContext().getStepExecution(); // Before starting a new transaction, check for // interruption. interruptionPolicy.checkInterrupted(stepExecution); RepeatStatus result; try { result = new TransactionTemplate(transactionManager, transactionAttribute) .execute(new ChunkTransactionCallback(chunkContext, semaphore)); } catch (UncheckedTransactionException e) { // Allow checked exceptions to be thrown inside callback throw (Exception) e.getCause(); } chunkListener.afterChunk(chunkContext); // Check for interruption after transaction as well, so that // the interrupted exception is correctly propagated up to // caller interruptionPolicy.checkInterrupted(stepExecution); return result == null ? RepeatStatus.FINISHED : result; }
@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 RepeatStatus doInChunkContext(RepeatContext repeatContext, ChunkContext chunkContext) throws Exception { StepExecution stepExecution = chunkContext.getStepContext().getStepExecution(); // Before starting a new transaction, check for // interruption. interruptionPolicy.checkInterrupted(stepExecution); RepeatStatus result; try { result = new TransactionTemplate(transactionManager, transactionAttribute) .execute(new ChunkTransactionCallback(chunkContext, semaphore)); } catch (UncheckedTransactionException e) { // Allow checked exceptions to be thrown inside callback throw (Exception) e.getCause(); } chunkListener.afterChunk(chunkContext); // Check for interruption after transaction as well, so that // the interrupted exception is correctly propagated up to // caller interruptionPolicy.checkInterrupted(stepExecution); return result == null ? RepeatStatus.FINISHED : result; }
@Override public RepeatStatus doInChunkContext(RepeatContext repeatContext, ChunkContext chunkContext) throws Exception { StepExecution stepExecution = chunkContext.getStepContext().getStepExecution(); // Before starting a new transaction, check for // interruption. interruptionPolicy.checkInterrupted(stepExecution); RepeatStatus result; try { result = new TransactionTemplate(transactionManager, transactionAttribute) .execute(new ChunkTransactionCallback(chunkContext, semaphore)); } catch (UncheckedTransactionException e) { // Allow checked exceptions to be thrown inside callback throw (Exception) e.getCause(); } chunkListener.afterChunk(chunkContext); // Check for interruption after transaction as well, so that // the interrupted exception is correctly propagated up to // caller interruptionPolicy.checkInterrupted(stepExecution); return result; }
@Override public void beforeChunk(ChunkContext context) { try { delegate.beforeChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public void afterChunk(ChunkContext context) { try { delegate.afterChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public void beforeChunk(ChunkContext context) { try { delegate.beforeChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public void afterChunk(ChunkContext context) { try { delegate.afterChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public void beforeChunk(ChunkContext context) { try { delegate.beforeChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public void afterChunk(ChunkContext context) { try { delegate.afterChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@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"); } } }
rollback(stepExecution); throw new UncheckedTransactionException(e);