Quartz Scheduler - 检查正在运行的作业

时间:2013-09-02 10:53:57

标签: c# quartz-scheduler

我使用以下代码检查正在运行的作业。我在调度程序启动后添加了此方法。但每次运行的作业数为0.如何正确检查正在运行的作业?

List<JobExecutionContext> currentJobs = scheduler.getCurrentlyExecutingJobs();
for (JobExecutionContext jobCtx: currentJobs){
jobName = jobCtx.getJobDetail().getName();
groupName = jobCtx.getJobDetail().getGroup();
if (jobName.equalsIgnoreCase("job_I_am_looking_for_name") && groupName.equalsIgnoreCase("job_group_I_am_looking_for_name")) {
    //found it!
    logger.warn("the job is already running - do nothing");
             return;
}               
}   

来源:find if a job is running in Quartz1.6

0 个答案:

没有答案