Skip to content

Commit d2000ef

Browse files
committed
Polishing
1 parent c23fd78 commit d2000ef

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskScheduler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -191,6 +191,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
191191
* @see Clock#systemDefaultZone()
192192
*/
193193
public void setClock(Clock clock) {
194+
Assert.notNull(clock, "Clock must not be null");
194195
this.clock = clock;
195196
}
196197

spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.springframework.scheduling.Trigger;
4242
import org.springframework.scheduling.support.DelegatingErrorHandlingRunnable;
4343
import org.springframework.scheduling.support.TaskUtils;
44+
import org.springframework.util.Assert;
4445
import org.springframework.util.ErrorHandler;
4546

4647
/**
@@ -114,10 +115,10 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements
114115
/**
115116
* Set the clock to use for scheduling purposes.
116117
* <p>The default clock is the system clock for the default time zone.
117-
* @since 5.3
118118
* @see Clock#systemDefaultZone()
119119
*/
120120
public void setClock(Clock clock) {
121+
Assert.notNull(clock, "Clock must not be null");
121122
this.clock = clock;
122123
}
123124

spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -159,6 +159,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
159159
* @see Clock#systemDefaultZone()
160160
*/
161161
public void setClock(Clock clock) {
162+
Assert.notNull(clock, "Clock must not be null");
162163
this.clock = clock;
163164
}
164165

spring-context/src/test/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutorTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
1717
package org.springframework.scheduling.concurrent;
1818

1919
import java.util.concurrent.Executor;
20+
import java.util.concurrent.Future;
2021
import java.util.concurrent.LinkedBlockingQueue;
21-
import java.util.concurrent.RunnableFuture;
2222
import java.util.concurrent.ThreadPoolExecutor;
2323
import java.util.concurrent.TimeUnit;
2424

@@ -52,8 +52,8 @@ protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecuto
5252
@AfterEach
5353
void shutdownExecutor() {
5454
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);
5757
}
5858
}
5959
}

spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private void await(CountDownLatch latch) {
147147
catch (InterruptedException ex) {
148148
throw new IllegalStateException(ex);
149149
}
150-
assertThat(latch.getCount()).as("latch did not count down,").isEqualTo(0);
150+
assertThat(latch.getCount()).as("latch did not count down").isEqualTo(0);
151151
}
152152

153153

0 commit comments

Comments
 (0)