Skip to content

Commit 021d9eb

Browse files
committed
Improve exception handling in JobExecutionShutdownHook
1 parent 184ac31 commit 021d9eb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobExecutionShutdownHook.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.apache.commons.logging.LogFactory;
2020

2121
import org.springframework.batch.core.job.JobExecution;
22+
import org.springframework.batch.core.launch.JobExecutionNotRunningException;
2223
import org.springframework.batch.core.launch.JobOperator;
2324

2425
/**
@@ -54,6 +55,9 @@ public void run() {
5455
this.jobOperator.stop(this.jobExecution);
5556
this.logger.info("Successfully stopped job execution " + jobExecutionId);
5657
}
58+
catch (JobExecutionNotRunningException e) {
59+
this.logger.warn("Job execution " + jobExecutionId + " is not running");
60+
}
5761
catch (Exception e) {
5862
throw new RuntimeException("Unable to gracefully stop job execution " + jobExecutionId, e);
5963
}

0 commit comments

Comments
 (0)