File tree 2 files changed +18
-3
lines changed
main/java/org/springframework/scheduling/config
test/java/org/springframework/scheduling/config
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,9 @@ public void cancel(boolean mayInterruptIfRunning) {
86
86
*/
87
87
@ Nullable
88
88
public Instant nextExecution () {
89
- if (this .future != null && !this .future .isCancelled ()) {
90
- long delay = this .future .getDelay (TimeUnit .MILLISECONDS );
89
+ ScheduledFuture <?> future = this .future ;
90
+ if (future != null && !future .isCancelled ()) {
91
+ long delay = future .getDelay (TimeUnit .MILLISECONDS );
91
92
if (delay > 0 ) {
92
93
return Instant .now ().plusMillis (delay );
93
94
}
Original file line number Diff line number Diff line change 24
24
25
25
/**
26
26
* Tests for {@link Task}.
27
+ *
27
28
* @author Brian Clozel
29
+ * @since 6.2
28
30
*/
29
31
class TaskTests {
30
32
@@ -77,20 +79,32 @@ static class TestRunnable implements Runnable {
77
79
78
80
@ Override
79
81
public void run () {
82
+ try {
83
+ Thread .sleep (1 );
84
+ }
85
+ catch (InterruptedException ex ) {
86
+ throw new RuntimeException (ex );
87
+ }
80
88
this .hasRun = true ;
81
89
}
82
90
}
83
91
92
+
84
93
static class FailingTestRunnable implements Runnable {
85
94
86
95
boolean hasRun ;
87
96
88
97
@ Override
89
98
public void run () {
99
+ try {
100
+ Thread .sleep (1 );
101
+ }
102
+ catch (InterruptedException ex ) {
103
+ throw new RuntimeException (ex );
104
+ }
90
105
this .hasRun = true ;
91
106
throw new IllegalStateException ("test exception" );
92
107
}
93
108
}
94
109
95
-
96
110
}
You can’t perform that action at this time.
0 commit comments