英文:
@Scheduled behaviour when processing takes a long time. run in parallel?
问题
如果该方法处理时间超过10秒,是否会同时启动另一个执行?还是会等待当前执行完成?
英文:
I have a method with @Scheduled and this is set to run every 10 secs like so:
@Scheduled(fixedDelay = 1000 * 10)
If the method takes more than 10 secs to process, will another execution start in parallel? or will it wait for the current execution to finish?
答案1
得分: 1
It won't, because fixedDelay
works like follows:
Execute the annotated method with a fixed period in milliseconds
between the end of the last invocation and the start of the next.
意味着它等待函数完成,然后等待 n 毫秒,然后再次调用函数。
英文:
It won't, because fixedDelay
works like follows:
> Execute the annotated method with a fixed period in milliseconds
> between the end of the last invocation and the start of the next.
Meaning that it waits for the function to complete and then waits n-milliseconds until the function is invoked again.
答案2
得分: 1
以下是翻译好的部分:
"它将等待前一个执行完成,我正在查看它的文档,上面写着
以毫秒为单位的固定周期执行带有注释的方法,上一次调用结束和下一次调用开始之间的间隔。
这里是Spring文档,我在那里看到它。"
英文:
It will wait until previous execution is completed I was going through its doc and its written over there
> Execute the annotated method with a fixed period in milliseconds
> between the end of the last invocation and the start of the next.
Here is the Spring Doc where I have seen it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论