sunkai-cai commented on a change in pull request #1955:
URL:
https://github.com/apache/shardingsphere-elasticjob/pull/1955#discussion_r684645797
##########
File path:
elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/JobScheduleController.java
##########
@@ -88,8 +92,25 @@ public synchronized void rescheduleJob() {
}
}
- private Trigger createCronTrigger(final String cron) {
- return
TriggerBuilder.newTrigger().withIdentity(triggerIdentity).withSchedule(CronScheduleBuilder.cronSchedule(cron).withMisfireHandlingInstructionDoNothing()).build();
+ private Trigger createCronTrigger(final String cron, final String
timeZoneString) {
+ return
TriggerBuilder.newTrigger().withIdentity(triggerIdentity).withSchedule(
+
CronScheduleBuilder.cronSchedule(cron).inTimeZone(parseTimeZoneString(timeZoneString)).withMisfireHandlingInstructionDoNothing()
+ ).build();
+ }
+
+ /**
+ * Get the TimeZone for the time zone specification.
+ *
+ * @param timeZoneString must start with "GMT", such as "GMT+8:00"
+ * @return the specified TimeZone, or the GMT zone if the `timeZoneString`
cannot be understood.
+ */
+ private TimeZone parseTimeZoneString(final String timeZoneString) {
+ if (null == timeZoneString) {
+ return TimeZone.getDefault();
+ }
+
Review comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]