1

Hi I would like A cronjob to be run within spring but I also need to make sure that they don't overlap when running is this possible. Using spring boot 5.1

@Scheduled(cron="${con}", fixedDelay = 5000)
 public void run(){
     some method
 }

this obviously fails is there some way to obtain this

Taher Galal
  • 297
  • 4
  • 23
  • Yes it is, and the posted code does exactly what you expect as mentioned [here](http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/annotation/Scheduled.html#fixedDelay--) – Bond - Java Bond Feb 24 '17 at 10:27

1 Answers1

0

Instead of configuring non-overlapping cron, you could check whether the previous run method has finished, and if it hasn't, exit your run() function.

Alex Pruss
  • 533
  • 5
  • 15