可以互换使用以下两个cron表达式吗?

发布于 2025-02-11 06:58:38 字数 419 浏览 0 评论 0 原文

我试图了解Java中如何写和解释Cron的表达方式。我无法理解以下两个表达式在物理意义上有何不同:
表达式1: * * * * 1/1 *? *
表达式2: * * * * * *? *

我提到 cronexpressionGenerator 的描述及其对两个表达的描述,如下:
表达1:每秒运行
表达式2:每天每秒运行
从物理意义上讲,他们俩每秒都运行。它们可以互换使用吗?

I am trying to understand how Cron expressions are written and interpreted in Java. I am unable to understand how the two expressions listed below differ in physical sense:
Expression 1: * * * 1/1 * ? *
Expression 2: * * * * * ? *

I referred to the description provided by CronExpressionGenerator and their description of the two expressions were as follows:
Expression 1: Runs every second
Expression 2: Runs every second every day
In a physical sense, they both run every second. Can they be used interchangeably?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花落人离去 2025-02-18 06:58:38

您没有发现Java的Cron。相反,您正在发现石英intepretes cron表达方式。石英比通常的Linux Cron守护程序更强大。

您正确地注意到,这两种表达式都以同一节奏发射。因此,您可以使用一个或另一个,并获得相同的结果。

此外,该文档可能有助于理解:

You are not finding out how Java does cron. Instead, you are finding out how Quartz intepretes cron expressions. Quartz is even more powerful than usual Linux cron daemons.

You noticed correctly that both expressions fire at the same rhythm. With that you may use one or the other and get the same result.

Additionally the documentation may help to understand:
http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/tutorials/tutorial-lesson-06.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文