Announcement Announcement Module
No announcement yet.
Batch stopped abruptly Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch stopped abruptly


    I have a batch running on a server. For some reasons, the server is stopped while the batch is running.
    The status of the batch job execution is STARTED.

    I start the server again and stop that execution (SimpleJobOperator.stop(long)). The status is STOPPING, and it stays so infinitely.

    Is there a way to force the job to stop? (timeout, other method to call, ...)

  • #2
    If the process died (CTRL-9 or server shutdown) the job is, of course, not running. But the JobRepository has no way of knowing because no-one told it before the process died. You have to tell it manually that you know that the execution either failed or should be considered aborted (change its status to FAILED or ABORTED) - it's a business decision and there is no way to automate it. Only change the status to FAILED if it is not restartable, or if you know the restart data is valid. There is a utility in Spring Batch Admin JobService to abort a job execution.


    • #3
      Thanks for your answer.
      Then, we will need to implement something that validates that the stop command has been successfully processed, and if not, change the status to FAILED.