简体   繁体   English

我如何在Java EE服务器中获得调度程序作业

[英]How I get the scheduler Jobs in Java EE server

I'm trying to get current Executing Job with the method scheduler.getCurrentlyExecutingJobs(); 我正在尝试使用scheduler.getCurrentlyExecutingJobs();方法获取当前的执行作业scheduler.getCurrentlyExecutingJobs(); but I really don't know how should be used. 但我真的不知道该如何使用。 i'm using jboss 4.2 and quartz 1.6 我正在使用jboss 4.2和石英1.6

scheduler.getCurrentlyExecutingJobs() method returns List of JobExecutionContext. scheduler.getCurrentlyExecutingJobs()方法返回JobExecutionContext的列表。 If you just wanted to get the name of the executing name you can make out from JobDetail which is available in JobExecutionContext. 如果您只想获取执行名称的名称,则可以从JobExecutionContext中可用的JobDetail中识别出来。

List jobs = scheduler.getCurrentlyExecutingJobs();
for (Iterator iter = jobs.iterator(); iter.hasNext();) {
    JobExecutionContext context = (JobExecutionContext) iter.next();
    System.out.println(context.getJobDetail().getName());
}

Note: This method does not behave as expected in cluster environments. 注意:此方法在群集环境中的行为不符合预期。 There is open bug for this issue. 问题有一个未解决的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM