## Proposed changes In some cases, users want to set the start time to a time in the past. **For periodic scheduling tasks only, the start time of a one-time task must be set to the future or present time** **If the start time is the past time, then the next execution time should be the start time + time interval.** (cherry picked from commit fa6061070f6d4063b1966e99fc285e4e6b9c3750) #36732
This commit is contained in:
@ -96,7 +96,7 @@ public class JobExecutionConfiguration {
|
||||
return;
|
||||
}
|
||||
if (timerDefinition.getStartTimeMs() < System.currentTimeMillis()) {
|
||||
throw new IllegalArgumentException("startTimeMs cannot be less than current time");
|
||||
throw new IllegalArgumentException("startTimeMs must be greater than current time");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,9 +39,6 @@ public class TimerDefinition {
|
||||
|
||||
|
||||
public void checkParams(boolean immediate) {
|
||||
if (null != startTimeMs && startTimeMs < System.currentTimeMillis()) {
|
||||
throw new IllegalArgumentException("startTimeMs must be greater than current time");
|
||||
}
|
||||
if (null != startTimeMs && immediate) {
|
||||
throw new IllegalArgumentException("startTimeMs must be null when immediate is true");
|
||||
}
|
||||
@ -52,7 +49,7 @@ public class TimerDefinition {
|
||||
startTimeMs = System.currentTimeMillis() + intervalUnit.getIntervalMs(interval);
|
||||
}
|
||||
if (null != endTimeMs && endTimeMs < startTimeMs) {
|
||||
throw new IllegalArgumentException("end time cannot be less than start time");
|
||||
throw new IllegalArgumentException("endTimeMs must be greater than the start time");
|
||||
}
|
||||
|
||||
if (null != intervalUnit) {
|
||||
|
||||
Reference in New Issue
Block a user