java - Spring : Spring scheduler with fixed-rate param work incorrectly

标签 java spring spring-mvc

有人认为 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 :

  1. 固定速率 是指执行该方法的频率,无论之前的执行需要多长时间。

  2. 固定延迟 指的是每个任务完成执行后等待/保持的毫秒数。

  3. 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/

相关文章:

java - 使用带有 VLCJ 的网络摄像头无法正常工作,而在 VLC 中使用相同的选项却可以工作 :

java - 将32位机开发的应用程序移植到64位机时需要进行Spring/Hibernate更改

java - jetty + SpringMVC : Error when set configureDefaultServletHandling because cannot find the default servlet name

Spring Boot,JSP 文件作为 View 在 IntelliJ 中运行时未加载

java - openCV中的模板匹配[JAVA]

java - 在 GWT 客户端中从 ReSTLet Framework 接收自定义异常

java - Spring-boot,JUnit 测试使用不同的配置文件

mysql - Spring Security - 查询security-context.xml中的变化

spring - 获取 Spring 3.1 MVC View 的渲染输出

java - 使用 jlabel 上的 imageicon 自动调整图像大小