Jul 15th, 2011, 12:17 PM
Job is Still Running Evidence
Please correct me if I am wrong but there is no real way to know if a job is still running or not. I know there is a status field that has a status I can check but suppose the plug is pulled on the machine running my spring batch job...that status will still say it's running on the database side!
Is there something spring batch does to help counter this problem? One idea is to have a pinger thread that reports the last seen in status running timestamp. To further explain this idea: this thread will, while a job is running, update the timestamp of a running job. If the timestamp is older than a threshold and the job is still in the running status, the job cannot connect to the database or failed!
Is there something like this built into spring batch?
Jul 15th, 2011, 12:24 PM
I guess I could just implement my own job launcher and have a background thread running that updates the status of that particular job...but I was wondering if this is a good idea.
Implementing this feature can help extend spring batch onto cluster processing.
Jul 18th, 2011, 06:24 AM
Spring Batch updates the lastUpdated field on StepExecution and JobExecution objects, and persists that stuff to the repository. That should give you all the ammunition you need. The framework can not do anything more than that with any confidence - if the plug is pulled as you point out, everything is going to stop, including the background thread that you propose.