use of eu.bcvsolutions.idm.core.scheduler.exception.InvalidCronExpressionException in project CzechIdMng by bcvsolutions.
the class DefaultSchedulerManager method createTriggerInternal.
private void createTriggerInternal(String taskId, CronTaskTrigger trigger, boolean dryRun) {
CronTaskTrigger cronTaskTrigger = (CronTaskTrigger) trigger;
CronScheduleBuilder cronBuilder;
try {
cronBuilder = CronScheduleBuilder.cronSchedule(cronTaskTrigger.getCron()).withMisfireHandlingInstructionDoNothing().inTimeZone(TimeZone.getDefault());
} catch (RuntimeException ex) {
throw new InvalidCronExpressionException(cronTaskTrigger.getCron(), ex);
}
//
try {
scheduler.scheduleJob(TriggerBuilder.newTrigger().withIdentity(trigger.getId(), taskId).forJob(getKey(taskId)).withDescription(cronTaskTrigger.getDescription()).withSchedule(cronBuilder).usingJobData(SchedulableTaskExecutor.PARAMETER_DRY_RUN, dryRun).startNow().build());
} catch (org.quartz.SchedulerException ex) {
throw new SchedulerException(CoreResultCode.SCHEDULER_CREATE_TRIGGER_FAILED, ex);
}
}
Aggregations