tags:

views:

251

answers:

1

Hello,

does anyone know if the following java Method in the java.util.concurrent Package ScheduledExecutorService.html#scheduleAtFixedRate()

absolutely guarantees, that the Runnable scheduled will never run in parallel in case the runnable from the "last" run did not yet finish:

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.

Thank you very much Jan

+1  A: 

From the docs:

If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

bruno conde
Hello Bruno,thanks! Well I really read and searched the java docs for this, but I dont know how I could oversee this. Thank you very much for your help! Jan
jan