Skip to content

Commit

Permalink
dynamic loading of job class improved
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Nov 25, 2012
1 parent 7fad171 commit d3ab9c0
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -54,11 +54,17 @@ public static void schedule(Scheduler scheduler, Document doc, Realm realm) thro
jobDesc = jobName;
}

Class<? extends org.quartz.Job> jobClass = Class.forName(jobE.getAttribute("class")).asSubclass(org.quartz.Job.class);
Class<? extends org.quartz.Job> jobClass;
try {
jobClass = Class.forName(jobE.getAttribute("class")).asSubclass(org.quartz.Job.class);
} catch(java.lang.ClassNotFoundException e) {
log.error("Job class '" + jobE.getAttribute("class") + "' not found, which has been scheduled/configured within realm '" + realm.getID() + "'");
log.error(e, e);
continue;
}
//JobDetailImpl jobDetail = new org.quartz.impl.JobDetailImpl(jobName, groupName, jobClass);
//jobDetail.setDescription(jobDesc);
JobDetail jobDetail = org.quartz.JobBuilder.newJob(jobClass).withIdentity(jobName, groupName).withDescription(jobDesc).build();

jobDetail.getJobDataMap().put("realm", realm);

Element triggerElement = (Element) jobE.getElementsByTagName("trigger").item(0);
Expand Down

0 comments on commit d3ab9c0

Please sign in to comment.