如何获取春季安排的石英工作列表?
我在弄清楚如何获取预定作业列表时遇到了一些麻烦。我在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在类中注入
scheduleFactory
(如果您使用注释,则使用 @Autowired)。You have to inject the
scheduleFactory
in your class (using @Autowired if you use annotations).