zoukankan      html  css  js  c++  java
  • schedule() 和 scheduleAtFixedRate() 区别

    1.  schedule() ,2个参数方法:
    在执行任务时,如果指定的计划执行时间scheduledExecutionTime <=
    systemCurrentTime,则task会被立即执行。

    2.  schedule() ,3个参数方法:
    在执行任务时,如果指定的计划执行时间scheduledExecutionTime <=
    systemCurrentTime,则task会被立即执行,之后按period参数固定重复执行。

    3.  scheduleAtFixedRate() ,3个参数方法:
    在执行任务时,如果指定的计划执行时间scheduledExecutionTime<=
    systemCurrentTime,则task会首先按执行一次;然后按照执行时间、系统当前时间和period参数计算出过期该执行的次数,计算按照:
    (systemCurrentTime-scheduledExecutionTime)/period,再次执行计算出的次数;最后按period参数固定重复执行。

    4.  schedule() 和scheduleAtFixedRate()

    schedule()方法更注重保持间隔时间的稳定。
    scheduleAtFixedRate()方法更注重保持执行频率的稳定。

  • 相关阅读:
    倍增
    「BZOJ 2152」聪聪可可
    「POJ 1741」Tree
    点分治
    高斯消元
    网络流24题之餐巾计划问题
    网络流24题之骑士共存问题
    网络流24题之方格取数问题
    网络流24题之负载平衡问题
    网络流24题之分配问题
  • 原文地址:https://www.cnblogs.com/jirglt/p/4210085.html
Copyright © 2011-2022 走看看