rainight(雨夜聆风) :你的回答好象不对吧,这里是询问
“schedule”和“scheduleAtFixedRate”的区别,而这两个方法中的每一个都包含你说的那两种情形的。

解决方案 »

  1.   

    对于scheduleAtFixedRate
    如果run()在时间周期之内完成,那么下一次的信号就会在下一次预定的时间产生。但是,如果run()无法在时间周期之内完成,那么等到run完成之后,下一次的信号产生就尽量赶上原本应该产生信号的时间。
      

  2.   

    哦,好象是这样的。
    “When scheduling a task for repeated execution, 
    you should use one of the schedule methods when smoothness is important 
    and a scheduleAtFixedRate method when time synchronization is more important. 
    For example, the AnnoyingBeep program uses the schedule method, 
    which means that the annoying beeps will all be at least 1 second apart. 
    If one beep is late for any reason, all subsequent beeps will be delayed. 
    If we decide that the AnnoyingBeep program should exit exactly 3 seconds after the first beep¡ªeven if it means 
    that two beeps might occur close together if a beep is delayed 
    for any reason¡ªwe should use the scheduleAtFixedRate method instead. ”