Jul 24th, 2012, 11:09 PM
Stopping Spring batch jobs gracefully
What is the best way to stop jobs gracefully ?
JobOperator provides stop(executionId) method but it only sends signal, there is no guarantee that post this statement execution the job has stopped.
To handle this, I am running an infinite loop that will getSummary for the execution-id and in the summary I check for the presence of substring status=BatchStatus.COMPLETED. The loop breaks when status is BatchStatus.COMPLETED
Is it the right approach or there is any better way of managing graceful shutdown of Spring batch jobs ?
Jul 25th, 2012, 01:39 PM
How does Spring Batch Admin handle the situation? Check out its source.
Tags for this Thread