java Cron 调度程序“禁用模式”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6252777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 15:02:52  来源:igfitidea点击:

Cron scheduler "disable pattern"

javacron

提问by Mykhaylo Adamovych

I have application with configured cron tasks. Tasks scheduler config is separated to distinct file.
Could I use same crone scheduler config to enable or disable any task by providing specific pattern?

我有配置了 cron 任务的应用程序。任务调度程序配置被分隔到不同的文件。
我可以使用相同的 crone 调度程序配置通过提供特定模式来启用或禁用任何任务吗?

PS. I got different parse exceptions whet trying to use values like -1, 2000, 2810 for year in the pattern. It works for year 2080, but is there any common approach to be used here?

附注。我遇到了不同的解析异常,试图在模式中使用像 -1、2000、2810 这样的年份值。它适用于 2080 年,但是这里有什么通用的方法可以使用吗?

Thanks.

谢谢。

回答by Yavin5

Try this cron scheduler expression to effectively disable it: 0 0 0 1 1 ? 2099

试试这个 cron 调度器表达式来有效地禁用它: 0 0 0 1 1 ? 2099