@Override public ExitStatus afterStep(StepExecution stepExecution) { try { delegate.afterStep(); } catch (Exception e) { throw new BatchRuntimeException(e); } return stepExecution.getExitStatus(); } }
@Test(expected=BatchRuntimeException.class) public void testAfterStepException() throws Exception { doThrow(new Exception("expected")).when(delegate).afterStep(); adapter.afterStep(null); } }
@Test public void testAfterStep() throws Exception { ExitStatus exitStatus = new ExitStatus("complete"); when(execution.getExitStatus()).thenReturn(exitStatus); assertEquals(exitStatus, adapter.afterStep(execution)); verify(delegate).afterStep(); }
@Override public void afterStep() { try { this.delegate.afterStep(); } catch (Exception e) { this.stepContext.setException(e); throw new BatchContainerRuntimeException(e); } }
@Override public ExitStatus afterStep(StepExecution stepExecution) { try { delegate.afterStep(); } catch (Exception e) { throw new BatchRuntimeException(e); } return stepExecution.getExitStatus(); } }
@Override public ExitStatus afterStep(StepExecution stepExecution) { try { delegate.afterStep(); } catch (Exception e) { throw new BatchRuntimeException(e); } return stepExecution.getExitStatus(); } }
@Override public void afterStep() { try { this.delegate.afterStep(); } catch (Exception e) { this.stepContext.setException(e); throw new BatchContainerRuntimeException(e); } }
@Override public ExitStatus afterStep(StepExecution stepExecution) { try { delegate.afterStep(); } catch (Exception e) { throw new BatchRuntimeException(e); } return stepExecution.getExitStatus(); } }
@Override public void afterStep() { try { this.delegate.afterStep(); } catch (Exception e) { this.stepContext.setException(e); throw new BatchContainerRuntimeException(e); } }
@Override protected void invokePostStepArtifacts() { // Don't call beforeStep() in the partitioned case, since we are now on a partition thread, and // have already called beforeStep() on the main thread as the spec says. if ((stepListeners != null) && (this.jobExecutionImpl.getPartitionInstance() == null)) { for (StepListener listenerProxy : stepListeners) { try { listenerProxy.afterStep(); } catch (Exception e) { ExceptionConfig.wrapBatchException(e); } } } }
@Override protected void invokePostStepArtifacts() { // Invoke the reducer after all parallel steps are done if (this.partitionReducerProxy != null) { try { if ((BatchStatus.COMPLETED).equals(stepContext.getBatchStatus())) { this.partitionReducerProxy.afterPartitionedStepCompletion(PartitionStatus.COMMIT); } else { this.partitionReducerProxy.afterPartitionedStepCompletion(PartitionStatus.ROLLBACK); } } catch (Exception e) { ExceptionConfig.wrapBatchException(e); } } // Called in spec'd order, e.g. Sec. 11.7 if (stepListeners != null) { for (StepListener listenerProxy : stepListeners) { // Call afterStep on all the step listeners try { listenerProxy.afterStep(); } catch (Exception e) { ExceptionConfig.wrapBatchException(e); } } } }
for (final StepListener l : stepListeners) { try { l.afterStep(); } catch (final Throwable e) { BatchLogger.LOGGER.failToRunJob(e, jobContext.getJobName(), step.getId(), l);