Java Scheduled Executor: does it guarantee parallel execution if the task is not finished yet

Does anyone know if the following java method in java.util.concurrent package ScheduledExecutorService.html#scheduleAtFixedRate()

absolutely guarantees that the Runnable schedule will never run in parallel if the runnable from the "last" run hasn't finished yet:

For example (pseudocode)

1.00 o'clock: scheduleAtFixedRate(MyRunnable, "Run ever Hour")`
//1.30 o'clock: MyRunnable Has finished (everthing is fine)
2.00 o'clock: MyRunnable is triggered to run again
3.00 o'clock: MyRunnable has NOT yet finished ==> What will happen here? 
Will java Simply SKIP the starting of MyRunnable (as the old instance has not yet 
finished) and try again at 4 o'clock or will Java start a NEW MyRunnable that then will 
run in parallel to the "old" MyRunnable.

      

Thanks a lot Jan

+2


source to share


1 answer


From the docs :



If any completion of this task takes longer than its period, then subsequent executions may start late, but will not be carried out simultaneously.

+2


source







All Articles