My ScheduledExecutorService is intended to run every 30 minutes - every start and middle of the hour (09:00 , 09:30 etc..). This is set up and runs fine when the task is less than 30 minutes long.
If during one instance of the cycles the execution time is more than 30 minutes what should I expect:
Many thanks !
There are two options for scheduling repeating tasks: scheduleAtFixedRate
and scheduleWithFixedDelay
. I'm assuming you are doing the former, because that's much easier to trigger every 30 minutes.
In which case, the Javadocs on this are quite clear:
If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
So if your 09:30 task takes 33 minutes, your 10:00 task will slip by 3 minutes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With