Java Spiel Vollzieher: Ist es garantiert nicht parallel laufen, wenn Aufgabe noch nicht beendet hat

StackOverflow https://stackoverflow.com/questions/1632371

  •  06-07-2019
  •  | 
  •  

Frage

Wer weiß, wenn die folgende Java-Methode in dem java.util.concurrent Paket ScheduledExecutorService.html#scheduleAtFixedRate()

absolut garantiert, dass der Runnable geplant wird nie die runnable aus dem „letzten“ läuft parallel im Fall läuft noch nicht fertig:

Zum Beispiel (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.

Vielen Dank Jan

War es hilfreich?

Lösung

Von der docs :

  

Wenn eine Ausführung dieser Aufgabe nimmt   länger als seine Zeit, dann   nachfolgende Ausführungen können spät beginnen,   aber nicht gleichzeitig ausgeführt werden.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top