使用 Quartz 安排特定时间间隔的作业

Schedule Job for specific hours interval using Quartz

我的 Quartz cron 表达式是这样的:

50 * 10-11 * * ?

根据我的理解,这意味着:

Run the job every 50 second of every minute within hours 10 to 11 (am) for every week/month and year.

问题是作业 运行 即使在上午 11 点之后..

我试过了

50 * 10-11 * * *

但是这样我得到了例外:

support for specifying both a day-of-week and a day-of-month parameter is not implemented

我找到了它的工作原理。 10-11 实际上意味着该工作将 运行 持续 2 小时而不是 1 小时。它将 运行 到 11:59:59。几分钟也是一样。如果我写:

50 0-10 10-11 * * ?

作业将在第 50 秒 运行 每小时(10 和 11)进行 11 次(0-10)。

希望这对像我这样的人有帮助:)