Announcement Announcement Module
No announcement yet.
Async job already running check Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Async job already running check

    Dear colleagues,

    We are using job launcher with async. task executor , i.e. returns immedatelly. is being called periodically by timer event.
    Upon each timer call of we want to check whether previous job execution is complete. If not, this timer event should be just ignored.

    Initially we launched execution with "new JobParameters()". So we were able to catch JobExecutionAlreadyRunningException and act correctly if previous execution is still in progress. But, if previous execution is complete, we are getting JobInstanceAlreadyCompleteException (because parameters are the same).

    On the other hand, if we change parameters upon each event , we get rid of JobInstanceAlreadyCompleteException but also don't get JobExecutionAlreadyRunningException that we need.

    Of course we can use some static flag or other tricks. But doesn't Spring Batch provide API to check if ANY execution of particular job is in progress , with no depend on parameters ?

    Many thanks in advance.

  • #2
    why don't you use the JobExplorer to get the JobExecutions of a given job? That way you can figure out if an instance of a particular Job is still running