جافا المقرر المنفذ: هل تضمن أن لا بالتوازي إذا المهمة لم تنته بعد

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

  •  06-07-2019
  •  | 
  •  

سؤال

لا أحد يعرف إذا كان أسلوب جافا التالية في java.util.concurrent حزمة ScheduledExecutorService.html#scheduleAtFixedRate()

وضمانات على الإطلاق، أن Runnable المقرر سيتم تشغيل أبدا في نفس الوقت في حالة 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.

وشكرا جزيلا لكم يناير

هل كانت مفيدة؟

المحلول

ومن في مستندات :

<اقتباس فقرة>   

إذا أي تنفيذ هذه المهمة يأخذ   أطول من فترة ما، ثم   قد تبدأ عمليات إعدام لاحقة في وقت متأخر،   ولكن سوف يتم تنفيذ واحد.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top