如何获取春季安排的石英工作列表?

发布于 2024-12-28 13:03:22 字数 473 浏览 1 评论 0原文

我在弄清楚如何获取预定作业列表时遇到了一些麻烦。我在 servlet-context.xml 文件中将作业、触发器和调度程序声明为 bean。作业正确触发并完成。我知道我应该使用scheduleFactory来获取调度程序并执行类似的操作:

for(String group: sched.getJobGroupNames()) {
    // enumerate each job in group
    for(JobKey jobKey : sched.getJobKeys(groupEquals(group))) {
        System.out.println("Found job identified by: " + jobKey);
    }

不过,我不知道如何从bean中获取scheduleFactory实例,因为我不应该创建一个新实例。我通过搜索许多论坛(包括此处)收集了所有这些信息。

请帮助我解决这个问题。

I am having some trouble figuring out how to get the list of scheduled jobs. I have the jobs, triggers, and scheduler declared as beans in my servlet-context.xml file. The job fires correctly and completes. I know I am suppose to use the scheduleFactory to grab a scheduler and do something like:

for(String group: sched.getJobGroupNames()) {
    // enumerate each job in group
    for(JobKey jobKey : sched.getJobKeys(groupEquals(group))) {
        System.out.println("Found job identified by: " + jobKey);
    }

Though, I do not know how to get the scheduleFactory instance from the bean since I am not suppose to be creating a new one. I have gathered all this info from searching many forums including here.

Please help me regarding this.

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

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

发布评论

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

评论(1

你的呼吸 2025-01-04 13:03:22

您必须在类中注入 scheduleFactory (如果您使用注释,则使用 @Autowired)。

You have to inject the scheduleFactory in your class (using @Autowired if you use annotations).

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