Skip to content

Commit 2fbdcd4

Browse files
hpoettkerfmbenhassine
authored andcommitted
Check dirty flag of step execution context before update in inner loop
1 parent 893e83e commit 2fbdcd4

File tree

1 file changed

+3
-1
lines changed
  • spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet

1 file changed

+3
-1
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,9 @@ public RepeatStatus doInTransaction(TransactionStatus status) {
431431
try {
432432
// Going to attempt a commit. If it fails this flag will
433433
// stay false and we can use that later.
434-
getJobRepository().updateExecutionContext(stepExecution);
434+
if (stepExecution.getExecutionContext().isDirty()) {
435+
getJobRepository().updateExecutionContext(stepExecution);
436+
}
435437
stepExecution.incrementCommitCount();
436438
if (logger.isDebugEnabled()) {
437439
logger.debug("Saving step execution before commit: " + stepExecution);

0 commit comments

Comments
 (0)