Limit the lifetime of a batch job

前端 未结 2 892
失恋的感觉
失恋的感觉 2021-01-27 06:48

Is there a way to limit the lifetime of a running spring-batch job to e.g. 23 hours?

We start a batch job daily by a cron job and he job takes about 9 hours. It happened

2条回答
  •  清歌不尽
    2021-01-27 07:17

    Spring Batch specifically avoids the issue of job orchestration which this falls into. That being said, you could add a listener to your job that checks for other instances running and calls stop on them before beginning that one. Not knowing what each job does, I'm not sure how effective that would be, but it should be a start.

提交回复
热议问题