}
}
config.put(JOB_CONFIG, properties);
config.put(JOB_SCHEDULE_INFO, scheduleInfo);
final ScheduleOptions options;
if ( scheduleInfo.expression != null ) {
if ( this.logger.isDebugEnabled() ) {
this.logger.debug("Adding timed event " + config.get(JOB_TOPIC) + "(" + scheduleInfo.jobId + ")" + " with cron expression " + scheduleInfo.expression);
}
options = localScheduler.EXPR(scheduleInfo.expression);
} else if ( scheduleInfo.period != null ) {
if ( this.logger.isDebugEnabled() ) {
this.logger.debug("Adding timed event " + config.get(JOB_TOPIC) + "(" + scheduleInfo.jobId + ")" + " with period " + scheduleInfo.period);
}
final Date startDate = new Date(System.currentTimeMillis() + scheduleInfo.period * 1000);
options = localScheduler.AT(startDate, -1, scheduleInfo.period);
} else {
// then it must be date
if ( this.logger.isDebugEnabled() ) {
this.logger.debug("Adding timed event " + config.get(JOB_TOPIC) + "(" + scheduleInfo.jobId + ")" + " with date " + scheduleInfo.date);
}
options = localScheduler.AT(scheduleInfo.date);
}
localScheduler.schedule(this, options.canRunConcurrently(false).name(scheduleInfo.jobId).config(config));
this.startedSchedulerJobs.add(scheduleInfo.jobId);
return true;
} else {
this.logger.error("No scheduler available to start timed event " + event);
}