I am calling the following piece to stop the job.
Set<Long> executions = jobOperator.getRunningExecutions("Job-Builder");
jobOperator.stop(longExecutions.iterator().next());
The above method is stopping the job but Tasklets are still running. After reading through comments from stackoverflow I changed tasklet
to use StoppableTasklet
in my project so that I can stop them from running when I call the joboperator.stop()
My question here is that I am not sure how to identify if a job has been stopped and do necessary action inside the stop overriden method when I implement StoppableTasklet
. Can you tell me on how I can do that in the overridden method?
You don't need to identify if the job has been stopped in your code. You need to implement the logic to stop the current tasklet and this logic will be called by the framework when you stop the job through
JobOperator#stop
.