renamed feature display to feature config

added concept of feature dependencies, if one feature depends on another feature, and it gets enabled, the other feature is enabled as well
changed some feature related apis
added ability to automatically decay warnings (separate feature)
added command to trigger the warn decay manually
added command to decay all active warnings
added method to scheduler service to directly start a cron job
This commit is contained in:
Sheldan
2020-04-29 21:25:26 +02:00
parent 85c47db5ed
commit d5482fabd4
60 changed files with 571 additions and 97 deletions

View File

@@ -44,6 +44,15 @@ public class QuartzConfigFactory {
.build();
}
public CronTrigger createBasicCronTrigger(String jobName, String jobGroup, Date startTime, String cronExpression, JobDataMap jobDataMap) {
return newTrigger()
.withSchedule(cronSchedule(cronExpression).inTimeZone(TimeZone.getTimeZone("UTC")).withMisfireHandlingInstructionDoNothing())
.startAt(startTime)
.usingJobData(jobDataMap)
.forJob(jobName, jobGroup)
.build();
}
public Trigger createSimpleOnceOnlyTrigger(Date startTime) {
return newTrigger()
.startAt(startTime)

View File

@@ -159,6 +159,18 @@ public class SchedulerServiceBean implements SchedulerService {
}
}
@Override
public String startCronJobWithParameters(String name, String group, JobDataMap dataMap, String cronExpression) {
Trigger cronTrigger = scheduleCreator.createBasicCronTrigger(name, group, new Date(), cronExpression, dataMap);
try {
schedulerFactoryBean.getScheduler().scheduleJob(cronTrigger);
return cronTrigger.getKey().getName();
} catch (SchedulerException e) {
log.error("Failed to start new job - {}", name, e);
return null;
}
}
@Override
public void stopTrigger(String triggerKey) {
try {

View File

@@ -7,24 +7,15 @@ import java.util.Date;
public interface SchedulerService {
void startScheduledJobs();
void scheduleJob(SchedulerJob job);
void updateJob(SchedulerJob job, Date startDate);
boolean unScheduleJob(String jobName);
boolean deleteJob(SchedulerJob job);
boolean pauseJob(SchedulerJob job);
boolean continueJob(SchedulerJob job);
boolean executeJob(SchedulerJob job);
String executeJobWithParametersOnce(String name, String group, JobDataMap dataMap, Date date);
String startCronJobWithParameters(String name, String group, JobDataMap dataMap, String cronExpression);
void stopTrigger(String triggerKey);
void startScheduler();
}