Jorge
Jorge

Reputation: 18237

How I get the scheduler Jobs in Java EE server

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

Upvotes: 1

Views: 556

Answers (1)

Jaydeep Patel
Jaydeep Patel

Reputation: 2423

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.

Upvotes: 1

Related Questions