2009-10-27 27 views
2

沒有人知道不平行運行,如果在java.util.concurrent中的下列Java方法包裝ScheduledExecutorService.html#scheduleAtFixedRate()Java的安排執行程序:它保證如果任務HAST尚未完成

絕對保證,該計劃的Runnable會在並行的情況下,永遠不會運行在「最後」運行的可運行還不完:

例如(僞)

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. 

非常感謝您 月

+0

我懷疑,問這個問題是任何不是簡單地閱讀你所提到的方法的Javadoc更快;) – sfussenegger 2009-10-27 17:40:46

+0

你好sfussenegger, 問題是我讀了Java doc和搜索在javadoc的信息,但不知何故忽視它... – jan 2009-10-27 17:48:13

回答

2

docs

如果此任務的任何執行需要 比其週期長,然後 後續執行可能起步晚, 但不會同時執行。

+0

你好布魯諾, 謝謝!那麼我真的閱讀和搜索這個java文檔,但我不知道如何監督這一點。非常感謝您的幫助!一月 – jan 2009-10-27 17:40:15

相關問題