Skip to content

Commit 563abdb

Browse files
committed
Move meta-data updates within the chunk transaction
Resolves #5199
1 parent 2de325d commit 563abdb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkOrientedStep.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,13 @@ protected void doExecute(StepExecution stepExecution) throws Exception {
371371
chunkTransactionEvent.begin();
372372
StepContribution contribution = stepExecution.createStepContribution();
373373
processNextChunk(transactionStatus, contribution, stepExecution);
374+
this.compositeItemStream.update(stepExecution.getExecutionContext());
375+
getJobRepository().updateExecutionContext(stepExecution);
376+
getJobRepository().update(stepExecution);
374377
chunkTransactionEvent.transactionStatus = transactionStatus.isRollbackOnly()
375378
? BatchMetrics.STATUS_ROLLED_BACK : BatchMetrics.STATUS_COMMITTED;
376379
chunkTransactionEvent.commit();
377380
});
378-
379-
this.compositeItemStream.update(stepExecution.getExecutionContext());
380-
getJobRepository().updateExecutionContext(stepExecution);
381-
getJobRepository().update(stepExecution);
382381
}
383382
}
384383

0 commit comments

Comments
 (0)