这个 Quartz Cron 表达式是如何执行的

发布于 2024-07-27 01:36:33 字数 435 浏览 3 评论 0原文

我有以下内容;

private String cronExpression = "";
private final String jobID = "MyJObID";
...
Scheduler scheduler = ServiceLocator.getInstance().getScheduler();
CronTrigger trigger = new CronTrigger(jobID , Scheduler.DEFAULT_GROUP, cronExpression);
JobDetail jobDetail = new JobDetail(jobID , Scheduler.DEFAULT_GROUP, MyJob.class);
scheduler.scheduleJob(jobDetail, trigger);

我的问题是空 cron 表达式何时触发此作业?

I have a the following;

private String cronExpression = "";
private final String jobID = "MyJObID";
...
Scheduler scheduler = ServiceLocator.getInstance().getScheduler();
CronTrigger trigger = new CronTrigger(jobID , Scheduler.DEFAULT_GROUP, cronExpression);
JobDetail jobDetail = new JobDetail(jobID , Scheduler.DEFAULT_GROUP, MyJob.class);
scheduler.scheduleJob(jobDetail, trigger);

My question is when is this job triggered for the empty cron expression?

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

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

发布评论

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

评论(2

二手情话 2024-08-03 01:36:33

你确定它有效吗?

只需查看 org.quartz.CronExpression#buildExpression() 方法代码,看起来应该抛出异常:

        if (exprOn <= DAY_OF_WEEK) {
            throw new ParseException("Unexpected end of expression.",
                        expression.length());
        }

      // exprOn should be equal to SECOND in case of empty String given

[在 Quartz 1.6.0 中检查]

Are you sure it works?

Just by looking at the org.quartz.CronExpression#buildExpression() method code it looks like an exception should be thrown:

        if (exprOn <= DAY_OF_WEEK) {
            throw new ParseException("Unexpected end of expression.",
                        expression.length());
        }

      // exprOn should be equal to SECOND in case of empty String given

[checked in Quartz 1.6.0]

笑叹一世浮沉 2024-08-03 01:36:33

感谢各位的帮助,找到问题了。

中设置为一些有意义的值

经过一晚的搜索,我发现该类在 JBoss 中注册为 MBean,并且 cron 表达式属性的值在部署描述符

Thanks for the help guys, found the issue.

After some night of searching i found out that the class was registered in JBoss as a MBean and a value for the cron expression attribute was set to some meaningful value in the deployment descriptor

Sigh

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