Results 1 to 2 of 2

Thread: How to implement job timeout

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    5

    Default How to implement job timeout

    Hello,

    I'm looking for ideas about the best way to put a timeout parameter around an entire job. I would also consider a similar parameter at the step level. In short, I would like to be able to specify that a Spring Batch job can run for 30 minutes max. If, after 30 minutes the job still running, it would be marked FAIL and terminated. At which point, the scheduler would be free to start future invocations of the job at the normal schedule. I need some sort of callback that is triggered after a fix internal and sees if the the job is still running. If it is, it should terminate it. Any ideas on how I can elegantly define a job (or steps) that could be configured with a timeout parameter? I'm aware of the transaction timeout parameter that is available around steps. However, I'm using web services and there is no formal transaction around these calls so this parameter is of little use to me.

    Any ideas? I figure spring or spring batch must have some hooks that will allow for an elegant solution.

    Andrew

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    Spring Batch Admin has metrics for StepExecution time and the sample shows how to use a StepExecutionServiceLevelMonitor to generate a JMX notification if a step exceeds a timeout. Turning that into a signal that you can react to locally or remotely is relatively trivial.

Posting Permissions

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