Java Scheduled Executor:タスクがまだ終了していない場合、並行して実行されないことを保証しますか

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

  •  06-07-2019
  •  | 
  •  

質問

java.util.concurrentパッケージの次のjavaメソッド ScheduledExecutorService.html#scheduleAtFixedRate()

絶対に保証します。「最後」からのランナブルが、実行はまだ終了していません:

例(擬似コード)

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.

どうもありがとう 1月

役に立ちましたか?

解決

ドキュメント

  

このタスクの実行に時間がかかる場合   その期間よりも長い   後続の実行が遅れて開始される場合があり、   同時に実行されません。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top