有人认为 Spring 调度程序的启动频率比设置固定速率参数中指示的频率高得多?
<task:scheduled-tasks scheduler="myScheduler">
<task:scheduled ref="beanB" method="methodB" fixed-rate="5000" initial-delay="1000"/>
最佳答案
引用Official Spring Documentation on Task Execution and Scheduling :
固定速率
是指执行该方法的频率,无论之前的执行需要多长时间。固定延迟
指的是每个任务完成执行后等待/保持的毫秒数。initial-delay
指的是在执行第一个方法之前等待/保持多少毫秒。
示例:
<task:scheduled-tasks scheduler="myScheduler">
<task:scheduled ref="beanB" method="methodB" fixed-delay="2000" fixed-rate="5000" initial-delay="1000"/>
</task:scheduled-tasks>
因此,在现有调度程序中添加fixed-delay
。
关于java - Spring : Spring scheduler with fixed-rate param work incorrectly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58013513/