if (schedule.getCallbackData() != null) {
jobData.putAll(schedule.getCallbackData());
}
// schedule the job now
EnhancedScheduler scheduler;
if (schedule.getScheduleType().isClustered()) {
scheduler = getMasterServerPluginContainer().getClusteredScheduler();
} else {
scheduler = getMasterServerPluginContainer().getNonClusteredScheduler();
}
if (schedule.getScheduleType() instanceof CronScheduleType) {
String cronExpression = ((CronScheduleType) schedule.getScheduleType()).getCronExpression();
log.info("Scheduling server plugin cron job: jobName=" + schedule.getJobId() + ", groupName=" + groupName
+ ", jobClass=" + jobClass + ", cron=" + cronExpression);
scheduler.scheduleCronJob(schedule.getJobId(), groupName, jobData, jobClass, rescheduleIfExists,
isVolatile, cronExpression);
} else {
long initialDelay = 10000L; // arbitrary - wait a small bit of time before triggering the job
long interval = ((PeriodicScheduleType) schedule.getScheduleType()).getPeriod();
log.info("Scheduling server plugin periodic job: jobName=" + schedule.getJobId() + ", groupName="
+ groupName + ", jobClass=" + jobClass + ", interval=" + interval);
scheduler.scheduleRepeatingJob(schedule.getJobId(), groupName, jobData, jobClass, rescheduleIfExists,
isVolatile, initialDelay, interval);
}
return;
}