views:

56

answers:

1

Hi, i'm trying to get current Executing Job with the method scheduler.getCurrentlyExecutingJobs(); but i really don't know how should be used. i'm using jboss 4.2 and quartz 1.6

+1  A: 

scheduler.getCurrentlyExecutingJobs() method returns List of JobExecutionContext. If you just wanted to get the name of the executing name you can make out from JobDetail which is available in JobExecutionContext.

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.

Jaydeep