Skip to content

Commit

Permalink
@scheduled supports config field
Browse files Browse the repository at this point in the history
  • Loading branch information
SummerBootFramework committed Oct 31, 2023
1 parent 72a9ae0 commit 36f81f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.summerboot</groupId>
<artifactId>jexpress</artifactId>
<version>2.3.11-SNAPSHOT</version>
<version>2.3.11</version>
<packaging>jar</packaging>
<name>Summer Boot jExpress</name>
<description>Summer Boot jExpress focuses on solving non-functional and operational maintainability requirements, some of which Spring Boot has (may) not yet provided</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static int addQuartzJob(Scheduler scheduler, Class<? extends Job> jobClas
try {
String[] cronExpressionsConfig = stringArrayFieldValue.value();
String[] cronExpressionsHardcoded = scheduledAnnotation.cron();
cronExpressions = BeanUtil.arrayMergeAndRemoveDuplicated(cronExpressionsConfig, cronExpressionsHardcoded);
cronExpressions = BeanUtil.arrayMergeAndRemoveDuplicated(cronExpressionsHardcoded, cronExpressionsConfig);
} catch (ClassCastException ex) {
throw new TypeNotPresentException(stringArrayFieldValue.buildClassCastExceptionDesc("String[]"), ex);
}
Expand All @@ -81,7 +81,7 @@ public static int addQuartzJob(Scheduler scheduler, Class<? extends Job> jobClas
try {
int[] daysOfMonthConfig = intArrayFieldValue.value();
int[] daysOfMonthHardcoded = scheduledAnnotation.daysOfMonth();
daysOfMonth = BeanUtil.arrayMergeAndRemoveDuplicated(daysOfMonthConfig, daysOfMonthHardcoded);
daysOfMonth = BeanUtil.arrayMergeAndRemoveDuplicated(daysOfMonthHardcoded, daysOfMonthConfig);
} catch (ClassCastException ex) {
throw new TypeNotPresentException(intArrayFieldValue.buildClassCastExceptionDesc("int[]"), ex);
}
Expand All @@ -91,7 +91,7 @@ public static int addQuartzJob(Scheduler scheduler, Class<? extends Job> jobClas
try {
int[] daysOfWeekhConfig = intArrayFieldValue.value();
int[] daysOfWeekHardcoded = scheduledAnnotation.daysOfWeek();
daysOfWeek = BeanUtil.arrayMergeAndRemoveDuplicated(daysOfWeekhConfig, daysOfWeekHardcoded);
daysOfWeek = BeanUtil.arrayMergeAndRemoveDuplicated(daysOfWeekHardcoded, daysOfWeekhConfig);
} catch (ClassCastException ex) {
throw new TypeNotPresentException(intArrayFieldValue.buildClassCastExceptionDesc("int[]"), ex);
}
Expand Down Expand Up @@ -252,7 +252,7 @@ public static int addQuartzJob(final Scheduler scheduler, final JobDetail jobDet
for (var dayOfMonth : daysOfMonth) {
CronTrigger trigger = TriggerBuilder.newTrigger()
.forJob(jobKey)
.withDescription(jobName + ".Monthly@" + dayOfMonth + "T" + trim(hour) + ":" + trim(minute))
.withDescription(jobName + ".Monthly@" + dayOfMonth + "md" + trim(hour) + "h:" + trim(minute) + "m")
.withSchedule(CronScheduleBuilder.monthlyOnDayAndHourAndMinute(dayOfMonth, trim(hour), trim(minute)))
.build();
scheduler.scheduleJob(trigger);
Expand All @@ -263,7 +263,7 @@ public static int addQuartzJob(final Scheduler scheduler, final JobDetail jobDet
int dayOfWeek = daysOfWeek[0];
CronTrigger trigger = TriggerBuilder.newTrigger()
.forJob(jobKey)
.withDescription(jobName + ".Weekly@" + QUARTZ_WEEKDAY_MAP.get(dayOfWeek) + "T" + trim(hour) + ":" + trim(minute))
.withDescription(jobName + ".Weekly@" + QUARTZ_WEEKDAY_MAP.get(dayOfWeek) + "md" + trim(hour) + "h:" + trim(minute) + "m")
.withSchedule(CronScheduleBuilder.weeklyOnDayAndHourAndMinute(dayOfWeek, trim(hour), trim(minute)))
.build();
scheduler.scheduleJob(trigger);
Expand All @@ -276,14 +276,14 @@ public static int addQuartzJob(final Scheduler scheduler, final JobDetail jobDet
}
CronTrigger trigger = TriggerBuilder.newTrigger()
.forJob(jobKey)
.withDescription(jobName + ".Weekly@" + desc + "T" + trim(hour) + ":" + trim(minute))
.withDescription(jobName + ".Weekly@" + desc + "wd" + trim(hour) + "h:" + trim(minute) + "m")
.withSchedule(CronScheduleBuilder.atHourAndMinuteOnGivenDaysOfWeek(trim(hour), trim(minute), dow))
.build();
scheduler.scheduleJob(trigger);
triggers++;
}
if (isDailyJob) {
String desc = jobName + ".Daily@" + hour + ":" + trim(minute);
String desc = jobName + ".Daily@" + hour + "h:" + trim(minute) + "m";
CronTrigger trigger = TriggerBuilder.newTrigger()
.forJob(jobKey)
.withDescription(desc)
Expand Down

0 comments on commit 36f81f1

Please sign in to comment.