File tree 4 files changed +15
-12
lines changed
main/java/org/springframework/scheduling/concurrent
test/java/org/springframework/scheduling/concurrent
4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -177,6 +177,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
177
177
* @see Clock#systemDefaultZone()
178
178
*/
179
179
public void setClock (Clock clock ) {
180
+ Assert .notNull (clock , "Clock must not be null" );
180
181
this .clock = clock ;
181
182
}
182
183
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
45
45
import org .springframework .util .concurrent .ListenableFutureTask ;
46
46
47
47
/**
48
- * Implementation of Spring's {@link TaskScheduler} interface, wrapping
49
- * a native {@link java.util.concurrent.ScheduledThreadPoolExecutor}.
48
+ * A standard implementation of Spring's {@link TaskScheduler} interface, wrapping
49
+ * a native {@link java.util.concurrent.ScheduledThreadPoolExecutor} and providing
50
+ * all applicable configuration options for it.
50
51
*
51
52
* @author Juergen Hoeller
52
53
* @author Mark Fisher
@@ -154,6 +155,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
154
155
* @see Clock#systemDefaultZone()
155
156
*/
156
157
public void setClock (Clock clock ) {
158
+ Assert .notNull (clock , "Clock must not be null" );
157
159
this .clock = clock ;
158
160
}
159
161
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
package org .springframework .scheduling .concurrent ;
18
18
19
19
import java .util .concurrent .Executor ;
20
+ import java .util .concurrent .Future ;
20
21
import java .util .concurrent .LinkedBlockingQueue ;
21
- import java .util .concurrent .RunnableFuture ;
22
22
import java .util .concurrent .ThreadPoolExecutor ;
23
23
import java .util .concurrent .TimeUnit ;
24
24
@@ -52,8 +52,8 @@ protected AsyncListenableTaskExecutor buildExecutor() {
52
52
@ AfterEach
53
53
void shutdownExecutor () {
54
54
for (Runnable task : concurrentExecutor .shutdownNow ()) {
55
- if (task instanceof RunnableFuture ) {
56
- ((RunnableFuture <?>) task ).cancel (true );
55
+ if (task instanceof Future ) {
56
+ ((Future <?>) task ).cancel (true );
57
57
}
58
58
}
59
59
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
39
39
* @author Sam Brannen
40
40
* @since 3.0
41
41
*/
42
- public class ThreadPoolTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests {
42
+ class ThreadPoolTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests {
43
43
44
44
private final ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler ();
45
45
@@ -97,7 +97,7 @@ void scheduleOneTimeTask() throws Exception {
97
97
}
98
98
99
99
@ Test
100
- void scheduleOneTimeFailingTaskWithoutErrorHandler () throws Exception {
100
+ void scheduleOneTimeFailingTaskWithoutErrorHandler () {
101
101
TestTask task = new TestTask (this .testName , 0 );
102
102
Future <?> future = scheduler .schedule (task , new Date ());
103
103
assertThatExceptionOfType (ExecutionException .class ).isThrownBy (() -> future .get (1000 , TimeUnit .MILLISECONDS ));
@@ -149,7 +149,7 @@ private void await(CountDownLatch latch) {
149
149
catch (InterruptedException ex ) {
150
150
throw new IllegalStateException (ex );
151
151
}
152
- assertThat (latch .getCount ()).as ("latch did not count down, " ).isEqualTo (0 );
152
+ assertThat (latch .getCount ()).as ("latch did not count down" ).isEqualTo (0 );
153
153
}
154
154
155
155
You can’t perform that action at this time.
0 commit comments