/** * Terminate if the chunk size has been reached, or the result is null. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(RepeatContext, * RepeatStatus) * @throws RuntimeException (normally terminating the batch) if the result is * itself an exception. */ @Override public boolean isComplete(RepeatContext context, RepeatStatus result) { return super.isComplete(context, result) || ((SimpleTerminationContext) context).isComplete(); }
@Override final public void update(RepeatContext context) { super.update(context); int delta = doUpdate(context); ((CountingBatchContext) context).getCounter().increment(delta); }
@Test public void testStepToCompletion() throws Exception { RepeatTemplate template = new RepeatTemplate(); // process all items: template.setCompletionPolicy(new DefaultResultCompletionPolicy()); step.setStepOperations(template); JobExecution jobExecutionContext = new JobExecution(jobInstance, jobParameters); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); step.execute(stepExecution); assertEquals(3, processed.size()); assertEquals(3, stepExecution.getReadCount()); }
/** * Terminate if the chunk size has been reached, or the result is null. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(RepeatContext, * RepeatStatus) * @throws RuntimeException (normally terminating the batch) if the result is * itself an exception. */ @Override public boolean isComplete(RepeatContext context, RepeatStatus result) { return super.isComplete(context, result) || ((SimpleTerminationContext) context).isComplete(); }
@Override final public void update(RepeatContext context) { super.update(context); int delta = doUpdate(context); ((CountingBatchContext) context).getCounter().increment(delta); }