Skip to content

Commit a9fffa8

Browse files
committed
Merge branch '6.1.x'
2 parents bb04c6b + c5590ae commit a9fffa8

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

spring-context/src/main/java/org/springframework/scheduling/TaskScheduler.java

Lines changed: 12 additions & 12 deletions
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.
@@ -68,7 +68,7 @@ default Clock getClock() {
6868
* @param trigger an implementation of the {@link Trigger} interface,
6969
* e.g. a {@link org.springframework.scheduling.support.CronTrigger} object
7070
* wrapping a cron expression
71-
* @return a {@link ScheduledFuture} representing pending completion of the task,
71+
* @return a {@link ScheduledFuture} representing pending execution of the task,
7272
* or {@code null} if the given Trigger object never fires (i.e. returns
7373
* {@code null} from {@link Trigger#nextExecution})
7474
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
@@ -85,7 +85,7 @@ default Clock getClock() {
8585
* @param task the Runnable to execute whenever the trigger fires
8686
* @param startTime the desired execution time for the task
8787
* (if this is in the past, the task will be executed immediately, i.e. as soon as possible)
88-
* @return a {@link ScheduledFuture} representing pending completion of the task
88+
* @return a {@link ScheduledFuture} representing pending execution of the task
8989
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
9090
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
9191
* @since 5.0
@@ -99,7 +99,7 @@ default Clock getClock() {
9999
* @param task the Runnable to execute whenever the trigger fires
100100
* @param startTime the desired execution time for the task
101101
* (if this is in the past, the task will be executed immediately, i.e. as soon as possible)
102-
* @return a {@link ScheduledFuture} representing pending completion of the task
102+
* @return a {@link ScheduledFuture} representing pending execution of the task
103103
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
104104
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
105105
* @deprecated as of 6.0, in favor of {@link #schedule(Runnable, Instant)}
@@ -118,7 +118,7 @@ default ScheduledFuture<?> schedule(Runnable task, Date startTime) {
118118
* @param startTime the desired first execution time for the task
119119
* (if this is in the past, the task will be executed immediately, i.e. as soon as possible)
120120
* @param period the interval between successive executions of the task
121-
* @return a {@link ScheduledFuture} representing pending completion of the task
121+
* @return a {@link ScheduledFuture} representing pending execution of the task
122122
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
123123
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
124124
* @since 5.0
@@ -134,7 +134,7 @@ default ScheduledFuture<?> schedule(Runnable task, Date startTime) {
134134
* @param startTime the desired first execution time for the task
135135
* (if this is in the past, the task will be executed immediately, i.e. as soon as possible)
136136
* @param period the interval between successive executions of the task (in milliseconds)
137-
* @return a {@link ScheduledFuture} representing pending completion of the task
137+
* @return a {@link ScheduledFuture} representing pending execution of the task
138138
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
139139
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
140140
* @deprecated as of 6.0, in favor of {@link #scheduleAtFixedRate(Runnable, Instant, Duration)}
@@ -151,7 +151,7 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, lo
151151
* {@link ScheduledFuture} gets cancelled.
152152
* @param task the Runnable to execute whenever the trigger fires
153153
* @param period the interval between successive executions of the task
154-
* @return a {@link ScheduledFuture} representing pending completion of the task
154+
* @return a {@link ScheduledFuture} representing pending execution of the task
155155
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
156156
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
157157
* @since 5.0
@@ -165,7 +165,7 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, lo
165165
* {@link ScheduledFuture} gets cancelled.
166166
* @param task the Runnable to execute whenever the trigger fires
167167
* @param period the interval between successive executions of the task (in milliseconds)
168-
* @return a {@link ScheduledFuture} representing pending completion of the task
168+
* @return a {@link ScheduledFuture} representing pending execution of the task
169169
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
170170
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
171171
* @deprecated as of 6.0, in favor of {@link #scheduleAtFixedRate(Runnable, Duration)}
@@ -185,7 +185,7 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
185185
* @param startTime the desired first execution time for the task
186186
* (if this is in the past, the task will be executed immediately, i.e. as soon as possible)
187187
* @param delay the delay between the completion of one execution and the start of the next
188-
* @return a {@link ScheduledFuture} representing pending completion of the task
188+
* @return a {@link ScheduledFuture} representing pending execution of the task
189189
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
190190
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
191191
* @since 5.0
@@ -203,7 +203,7 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
203203
* (if this is in the past, the task will be executed immediately, i.e. as soon as possible)
204204
* @param delay the delay between the completion of one execution and the start of the next
205205
* (in milliseconds)
206-
* @return a {@link ScheduledFuture} representing pending completion of the task
206+
* @return a {@link ScheduledFuture} representing pending execution of the task
207207
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
208208
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
209209
* @deprecated as of 6.0, in favor of {@link #scheduleWithFixedDelay(Runnable, Instant, Duration)}
@@ -220,7 +220,7 @@ default ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime,
220220
* {@link ScheduledFuture} gets cancelled.
221221
* @param task the Runnable to execute whenever the trigger fires
222222
* @param delay the delay between the completion of one execution and the start of the next
223-
* @return a {@link ScheduledFuture} representing pending completion of the task
223+
* @return a {@link ScheduledFuture} representing pending execution of the task
224224
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
225225
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
226226
* @since 5.0
@@ -235,7 +235,7 @@ default ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime,
235235
* @param task the Runnable to execute whenever the trigger fires
236236
* @param delay the delay between the completion of one execution and the start of the next
237237
* (in milliseconds)
238-
* @return a {@link ScheduledFuture} representing pending completion of the task
238+
* @return a {@link ScheduledFuture} representing pending execution of the task
239239
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
240240
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
241241
* @deprecated as of 6.0, in favor of {@link #scheduleWithFixedDelay(Runnable, Duration)}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
* which tend to have specific constraints for the scheduler thread pool,
7777
* requiring a separate thread pool for general executor purposes in practice.
7878
*
79+
* <p><b>NOTE: This scheduler variant does not track the actual completion of tasks
80+
* but rather just the hand-off to an execution thread.</b> As a consequence,
81+
* a {@link ScheduledFuture} handle (e.g. from {@link #schedule(Runnable, Instant)})
82+
* represents that hand-off rather than the actual completion of the provided task
83+
* (or series of repeated tasks).
84+
*
7985
* <p>As an alternative to the built-in thread-per-task capability, this scheduler
8086
* can also be configured with a separate target executor for scheduled task
8187
* execution through {@link #setTargetTaskExecutor}: e.g. pointing to a shared

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@
5353
/**
5454
* A standard implementation of Spring's {@link TaskScheduler} interface, wrapping
5555
* a native {@link java.util.concurrent.ScheduledThreadPoolExecutor} and providing
56-
* all applicable configuration options for it.
56+
* all applicable configuration options for it. The default number of scheduler
57+
* threads is 1; a higher number can be configured through {@link #setPoolSize}.
58+
*
59+
* <p>This is Spring's traditional scheduler variant, staying as close as possible to
60+
* {@link java.util.concurrent.ScheduledExecutorService} semantics. Task execution happens
61+
* on the scheduler thread(s) rather than on separate execution threads. As a consequence,
62+
* a {@link ScheduledFuture} handle (e.g. from {@link #schedule(Runnable, Instant)})
63+
* represents the actual completion of the provided task (or series of repeated tasks).
5764
*
5865
* @author Juergen Hoeller
5966
* @author Mark Fisher
@@ -64,6 +71,8 @@
6471
* @see #setExecuteExistingDelayedTasksAfterShutdownPolicy
6572
* @see #setThreadFactory
6673
* @see #setErrorHandler
74+
* @see ThreadPoolTaskExecutor
75+
* @see SimpleAsyncTaskScheduler
6776
*/
6877
@SuppressWarnings({"serial", "deprecation"})
6978
public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport

spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ else if (obj instanceof Number number) {
229229
try {
230230
return rs.getObject(index, requiredType);
231231
}
232-
catch (AbstractMethodError err) {
233-
logger.debug("JDBC driver does not implement JDBC 4.1 'getObject(int, Class)' method", err);
234-
}
235-
catch (SQLFeatureNotSupportedException ex) {
232+
catch (SQLFeatureNotSupportedException | AbstractMethodError ex) {
236233
logger.debug("JDBC driver does not support JDBC 4.1 'getObject(int, Class)' method", ex);
237234
}
238235
catch (SQLException ex) {
239-
logger.debug("JDBC driver has limited support for JDBC 4.1 'getObject(int, Class)' method", ex);
236+
if (logger.isDebugEnabled()) {
237+
logger.debug("JDBC driver has limited support for 'getObject(int, Class)' with column type: " +
238+
requiredType.getName(), ex);
239+
}
240240
}
241241

242242
// Corresponding SQL types for JSR-310 / Joda-Time types, left up

0 commit comments

Comments
 (0)