TeslaCN commented on a change in pull request #1955:
URL: 
https://github.com/apache/shardingsphere-elasticjob/pull/1955#discussion_r684326907



##########
File path: 
elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/JobScheduleController.java
##########
@@ -88,8 +91,23 @@ 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();
+    }
+    
+    private TimeZone parseTimeZoneString(final String timeZoneString) {
+        TimeZone timeZone;

Review comment:
       Name the variable `result`, please.

##########
File path: 
elasticjob-lite/elasticjob-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/RescheduleListenerManagerTest.java
##########
@@ -63,19 +63,19 @@ public void assertStart() {
     @Test
     public void assertCronSettingChangedJobListenerWhenIsNotCronPath() {
         rescheduleListenerManager.new 
CronSettingAndJobEventChangedJobListener().dataChanged("/test_job/config/other",
 Type.NODE_CREATED, LiteYamlConstants.getJobYaml());
-        verify(jobScheduleController, 
times(0)).rescheduleJob(ArgumentMatchers.any());
+        verify(jobScheduleController, 
times(0)).rescheduleJob(ArgumentMatchers.any(), ArgumentMatchers.any());

Review comment:
       Use static import for `ArgumentMatchers`.

##########
File path: 
elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/JobScheduleController.java
##########
@@ -88,8 +91,23 @@ 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();
+    }
+    
+    private TimeZone parseTimeZoneString(final String timeZoneString) {
+        TimeZone timeZone;
+        if (null != timeZoneString) {
+            timeZone = TimeZone.getTimeZone(timeZoneString);
+            if ("GMT".equals(timeZone.getID()) && 
!timeZoneString.startsWith("GMT")) {

Review comment:
       Consider using `Preconditions`.




-- 
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]


Reply via email to