File tree 4 files changed +14
-11
lines changed
main/java/org/springframework/scheduling/concurrent
test/java/org/springframework/scheduling/concurrent
4 files changed +14
-11
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.
@@ -183,6 +183,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
183
183
* @see Clock#systemDefaultZone()
184
184
*/
185
185
public void setClock (Clock clock ) {
186
+ Assert .notNull (clock , "Clock must not be null" );
186
187
this .clock = clock ;
187
188
}
188
189
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.
46
46
import org .springframework .util .concurrent .ListenableFutureTask ;
47
47
48
48
/**
49
- * Implementation of Spring's {@link TaskScheduler} interface, wrapping
50
- * a native {@link java.util.concurrent.ScheduledThreadPoolExecutor}.
49
+ * A standard implementation of Spring's {@link TaskScheduler} interface, wrapping
50
+ * a native {@link java.util.concurrent.ScheduledThreadPoolExecutor} and providing
51
+ * all applicable configuration options for it.
51
52
*
52
53
* @author Juergen Hoeller
53
54
* @author Mark Fisher
@@ -158,6 +159,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
158
159
* @see Clock#systemDefaultZone()
159
160
*/
160
161
public void setClock (Clock clock ) {
162
+ Assert .notNull (clock , "Clock must not be null" );
161
163
this .clock = clock ;
162
164
}
163
165
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 org.springframework.core.task.AsyncListenableTaskExecutor buildExecuto
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-2022 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.
@@ -101,7 +101,7 @@ void scheduleOneTimeTask() throws Exception {
101
101
102
102
@ Test
103
103
@ SuppressWarnings ("deprecation" )
104
- void scheduleOneTimeFailingTaskWithoutErrorHandler () throws Exception {
104
+ void scheduleOneTimeFailingTaskWithoutErrorHandler () {
105
105
TestTask task = new TestTask (this .testName , 0 );
106
106
Future <?> future = scheduler .schedule (task , new Date ());
107
107
assertThatExceptionOfType (ExecutionException .class ).isThrownBy (() -> future .get (1000 , TimeUnit .MILLISECONDS ));
@@ -147,7 +147,7 @@ private void await(CountDownLatch latch) {
147
147
catch (InterruptedException ex ) {
148
148
throw new IllegalStateException (ex );
149
149
}
150
- assertThat (latch .getCount ()).as ("latch did not count down, " ).isEqualTo (0 );
150
+ assertThat (latch .getCount ()).as ("latch did not count down" ).isEqualTo (0 );
151
151
}
152
152
153
153
You can’t perform that action at this time.
0 commit comments