Results 1 to 2 of 2

Thread: Async job already running check

  1. #1

    Post Async job already running check

    Dear colleagues,

    We are using job launcher with async. task executor , i.e. jobLauncher.run returns immedatelly.

    jobLauncher.run is being called periodically by timer event.
    Upon each timer call of jobLauncher.run 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. #2

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •