Limit the lifetime of a batch job

前端 未结 2 945
失恋的感觉
失恋的感觉 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:00

    If you write your own job class to launch the process you can make your class implement StatefulJob interface, which prevents concurrent launches of the same job. Apart from that you can write your own monitoring and stop the job programatically after some period, but it will require some custom coding, I dont know if there is anything build-in for such use case.

提交回复
热议问题