@Scheduled 处理时间较长时的行为。 运行并行?
@Scheduled behaviour when processing takes a long time. run in parallel?
我有一个带有@Scheduled 的方法,它设置为每 10 秒 运行,如下所示:
@Scheduled(fixedDelay = 1000 * 10)
如果该方法的处理时间超过 10 秒,是否会并行开始另一个执行?还是会等待当前执行完成?
不会,因为 fixedDelay
的工作原理如下:
Execute the annotated method with a fixed period in milliseconds
between the end of the last invocation and the start of the next.
意思是等待函数完成,然后等待n-milliseconds直到函数再次被调用。
它将等到上一次执行完成我正在浏览它的文档并写在那里
Execute the annotated method with a fixed period in milliseconds
between the end of the last invocation and the start of the next.
这是我看到的Spring Doc。
我有一个带有@Scheduled 的方法,它设置为每 10 秒 运行,如下所示:
@Scheduled(fixedDelay = 1000 * 10)
如果该方法的处理时间超过 10 秒,是否会并行开始另一个执行?还是会等待当前执行完成?
不会,因为 fixedDelay
的工作原理如下:
Execute the annotated method with a fixed period in milliseconds between the end of the last invocation and the start of the next.
意思是等待函数完成,然后等待n-milliseconds直到函数再次被调用。
它将等到上一次执行完成我正在浏览它的文档并写在那里
Execute the annotated method with a fixed period in milliseconds between the end of the last invocation and the start of the next.
这是我看到的Spring Doc。