Jade Tang
Jade Tang

Reputation: 319

is it ok that two spring batch job overlaps?

Suppose I have a spring job run every 5 minute, usually the job will take about one minute to complete, but if something goes wrong the job will last more than 5 minute. Before last job finished , another job will start. So, the two jobs will interfere with each other?

ps: I use the spring schedule annotation to schedule jobs.

Upvotes: 0

Views: 686

Answers (1)

Jeff Storey
Jeff Storey

Reputation: 57192

You can control this behavior. If you want to leave a fixed amount of time between the end of one job and the start of the next, use the fixedDelay http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/annotation/Scheduled.html#fixedDelay--.

If you use the fixedRate, then jobs may overlap. Whether that's "ok" depends on what your job does. But you can prevent this from happening with fixedDelay if you want.

Upvotes: 1

Related Questions