1818
1919import java .time .Duration ;
2020import java .util .Date ;
21- import java .util .concurrent .TimeUnit ;
2221
2322import org .springframework .scheduling .Trigger ;
2423import org .springframework .scheduling .TriggerContext ;
@@ -48,8 +47,7 @@ public class DynamicPeriodicTrigger implements Trigger {
4847 private boolean fixedRate = false ;
4948
5049 /**
51- * Create a trigger with the given period in milliseconds. The underlying
52- * {@link TimeUnit} will be initialized to TimeUnit.MILLISECONDS.
50+ * Create a trigger with the given period in milliseconds.
5351 * @param period Must not be negative
5452 */
5553 public DynamicPeriodicTrigger (long period ) {
@@ -68,10 +66,8 @@ public DynamicPeriodicTrigger(Duration duration) {
6866 }
6967
7068 /**
71- * Specify the delay for the initial execution. It will be evaluated in
72- * terms of this trigger's {@link TimeUnit}. If no time unit was explicitly
73- * provided upon instantiation, the default is milliseconds.
74- * @param initialDuration the initial delay in milliseconds.
69+ * Specify the delay for the initial execution.
70+ * @param initialDuration the initial delay.
7571 * @since 5.1
7672 */
7773 public void setInitialDuration (Duration initialDuration ) {
@@ -139,7 +135,9 @@ public Date nextExecutionTime(TriggerContext triggerContext) {
139135 else if (this .fixedRate ) {
140136 return new Date (lastScheduled .getTime () + this .duration .toMillis ());
141137 }
142- return new Date (triggerContext .lastCompletionTime ().getTime () + this .duration .toMillis ()); // NOSONAR never null here
138+ return
139+ new Date (triggerContext .lastCompletionTime ().getTime () + // NOSONAR never null here
140+ this .duration .toMillis ());
143141 }
144142
145143 @ Override
@@ -183,5 +181,4 @@ else if (!this.duration.equals(other.duration)) {
183181 }
184182 }
185183
186-
187184}
0 commit comments