1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2022 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.
@@ -89,11 +89,8 @@ default Clock getClock() {
89
89
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
90
90
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
91
91
* @since 5.0
92
- * @see #schedule(Runnable, Date)
93
92
*/
94
- default ScheduledFuture <?> schedule (Runnable task , Instant startTime ) {
95
- return schedule (task , Date .from (startTime ));
96
- }
93
+ ScheduledFuture <?> schedule (Runnable task , Instant startTime );
97
94
98
95
/**
99
96
* Schedule the given {@link Runnable}, invoking it at the specified execution time.
@@ -105,8 +102,12 @@ default ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
105
102
* @return a {@link ScheduledFuture} representing pending completion of the task
106
103
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
107
104
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
105
+ * @deprecated as of 6.0, in favor of {@link #schedule(Runnable, Instant)}
108
106
*/
109
- ScheduledFuture <?> schedule (Runnable task , Date startTime );
107
+ @ Deprecated
108
+ default ScheduledFuture <?> schedule (Runnable task , Date startTime ) {
109
+ return schedule (task , startTime .toInstant ());
110
+ }
110
111
111
112
/**
112
113
* Schedule the given {@link Runnable}, invoking it at the specified execution time
@@ -121,11 +122,8 @@ default ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
121
122
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
122
123
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
123
124
* @since 5.0
124
- * @see #scheduleAtFixedRate(Runnable, Date, long)
125
125
*/
126
- default ScheduledFuture <?> scheduleAtFixedRate (Runnable task , Instant startTime , Duration period ) {
127
- return scheduleAtFixedRate (task , Date .from (startTime ), period .toMillis ());
128
- }
126
+ ScheduledFuture <?> scheduleAtFixedRate (Runnable task , Instant startTime , Duration period );
129
127
130
128
/**
131
129
* Schedule the given {@link Runnable}, invoking it at the specified execution time
@@ -139,8 +137,12 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Instant startTime,
139
137
* @return a {@link ScheduledFuture} representing pending completion of the task
140
138
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
141
139
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
140
+ * @deprecated as of 6.0, in favor of {@link #scheduleAtFixedRate(Runnable, Instant, Duration)}
142
141
*/
143
- ScheduledFuture <?> scheduleAtFixedRate (Runnable task , Date startTime , long period );
142
+ @ Deprecated
143
+ default ScheduledFuture <?> scheduleAtFixedRate (Runnable task , Date startTime , long period ) {
144
+ return scheduleAtFixedRate (task , startTime .toInstant (), Duration .ofMillis (period ));
145
+ }
144
146
145
147
/**
146
148
* Schedule the given {@link Runnable}, starting as soon as possible and
@@ -153,11 +155,8 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Instant startTime,
153
155
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
154
156
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
155
157
* @since 5.0
156
- * @see #scheduleAtFixedRate(Runnable, long)
157
158
*/
158
- default ScheduledFuture <?> scheduleAtFixedRate (Runnable task , Duration period ) {
159
- return scheduleAtFixedRate (task , period .toMillis ());
160
- }
159
+ ScheduledFuture <?> scheduleAtFixedRate (Runnable task , Duration period );
161
160
162
161
/**
163
162
* Schedule the given {@link Runnable}, starting as soon as possible and
@@ -169,8 +168,12 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Duration period) {
169
168
* @return a {@link ScheduledFuture} representing pending completion of the task
170
169
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
171
170
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
171
+ * @deprecated as of 6.0, in favor of {@link #scheduleAtFixedRate(Runnable, Duration)}
172
172
*/
173
- ScheduledFuture <?> scheduleAtFixedRate (Runnable task , long period );
173
+ @ Deprecated
174
+ default ScheduledFuture <?> scheduleAtFixedRate (Runnable task , long period ) {
175
+ return scheduleAtFixedRate (task , Duration .ofMillis (period ));
176
+ }
174
177
175
178
/**
176
179
* Schedule the given {@link Runnable}, invoking it at the specified execution time
@@ -186,11 +189,8 @@ default ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Duration period) {
186
189
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
187
190
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
188
191
* @since 5.0
189
- * @see #scheduleWithFixedDelay(Runnable, Date, long)
190
192
*/
191
- default ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , Instant startTime , Duration delay ) {
192
- return scheduleWithFixedDelay (task , Date .from (startTime ), delay .toMillis ());
193
- }
193
+ ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , Instant startTime , Duration delay );
194
194
195
195
/**
196
196
* Schedule the given {@link Runnable}, invoking it at the specified execution time
@@ -206,8 +206,12 @@ default ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Instant startTi
206
206
* @return a {@link ScheduledFuture} representing pending completion of the task
207
207
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
208
208
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
209
+ * @deprecated as of 6.0, in favor of {@link #scheduleWithFixedDelay(Runnable, Instant, Duration)}
209
210
*/
210
- ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , Date startTime , long delay );
211
+ @ Deprecated
212
+ default ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , Date startTime , long delay ) {
213
+ return scheduleWithFixedDelay (task , startTime .toInstant (), Duration .ofMillis (delay ));
214
+ }
211
215
212
216
/**
213
217
* Schedule the given {@link Runnable}, starting as soon as possible and invoking it with
@@ -220,11 +224,8 @@ default ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Instant startTi
220
224
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
221
225
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
222
226
* @since 5.0
223
- * @see #scheduleWithFixedDelay(Runnable, long)
224
227
*/
225
- default ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , Duration delay ) {
226
- return scheduleWithFixedDelay (task , delay .toMillis ());
227
- }
228
+ ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , Duration delay );
228
229
229
230
/**
230
231
* Schedule the given {@link Runnable}, starting as soon as possible and invoking it with
@@ -237,7 +238,11 @@ default ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Duration delay)
237
238
* @return a {@link ScheduledFuture} representing pending completion of the task
238
239
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
239
240
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
241
+ * @deprecated as of 6.0, in favor of {@link #scheduleWithFixedDelay(Runnable, Duration)}
240
242
*/
241
- ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , long delay );
243
+ @ Deprecated
244
+ default ScheduledFuture <?> scheduleWithFixedDelay (Runnable task , long delay ) {
245
+ return scheduleWithFixedDelay (task , Duration .ofMillis (delay ));
246
+ }
242
247
243
248
}
0 commit comments