use of org.quartz.impl.triggers.CronTriggerImpl in project opennms by OpenNMS.
the class ImportScheduler method buildImportSchedule.
/**
* <p>buildImportSchedule</p>
*/
protected void buildImportSchedule() {
synchronized (m_lock) {
Iterator<RequisitionDef> it = m_configDao.getDefs().iterator();
while (it.hasNext()) {
RequisitionDef def = it.next();
JobDetail detail = null;
CronTriggerImpl trigger = null;
try {
detail = new JobDetailImpl(def.getImportName().orElse(null), JOB_GROUP, ImportJob.class, false, false);
detail.getJobDataMap().put(ImportJob.URL, def.getImportUrlResource());
detail.getJobDataMap().put(ImportJob.RESCAN_EXISTING, def.getRescanExisting());
trigger = new CronTriggerImpl(def.getImportName().orElse(null), JOB_GROUP, def.getCronSchedule().orElse(null));
trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);
getScheduler().scheduleJob(detail, trigger);
} catch (ParseException e) {
LOG.error("buildImportSchedule: {}", e.getLocalizedMessage(), e);
} catch (SchedulerException e) {
LOG.error("buildImportSchedule: {}", e.getLocalizedMessage(), e);
}
}
}
printCurrentSchedule();
}
Aggregations