18
18
19
19
import java .time .Duration ;
20
20
import java .util .Date ;
21
- import java .util .concurrent .TimeUnit ;
22
21
23
22
import org .springframework .scheduling .Trigger ;
24
23
import org .springframework .scheduling .TriggerContext ;
@@ -48,8 +47,7 @@ public class DynamicPeriodicTrigger implements Trigger {
48
47
private boolean fixedRate = false ;
49
48
50
49
/**
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.
53
51
* @param period Must not be negative
54
52
*/
55
53
public DynamicPeriodicTrigger (long period ) {
@@ -68,10 +66,8 @@ public DynamicPeriodicTrigger(Duration duration) {
68
66
}
69
67
70
68
/**
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.
75
71
* @since 5.1
76
72
*/
77
73
public void setInitialDuration (Duration initialDuration ) {
@@ -139,7 +135,9 @@ public Date nextExecutionTime(TriggerContext triggerContext) {
139
135
else if (this .fixedRate ) {
140
136
return new Date (lastScheduled .getTime () + this .duration .toMillis ());
141
137
}
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 ());
143
141
}
144
142
145
143
@ Override
@@ -183,5 +181,4 @@ else if (!this.duration.equals(other.duration)) {
183
181
}
184
182
}
185
183
186
-
187
184
}
0 commit comments