@@ -111,7 +111,7 @@ public TaskScheduler getScheduler() {
111
111
public void setTriggerTasks (Map <Runnable , Trigger > triggerTasks ) {
112
112
this .triggerTasks = new ArrayList <TriggerTask >();
113
113
for (Map .Entry <Runnable , Trigger > task : triggerTasks .entrySet ()) {
114
- this . triggerTasks . add (new TriggerTask (task .getKey (), task .getValue ()));
114
+ addTriggerTask (new TriggerTask (task .getKey (), task .getValue ()));
115
115
}
116
116
}
117
117
@@ -127,10 +127,11 @@ public void setTriggerTasksList(List<TriggerTask> triggerTasks) {
127
127
128
128
/**
129
129
* Get the trigger tasks as an unmodifiable list of {@link TriggerTask} objects.
130
+ * @return the list of tasks (never {@code null})
130
131
* @since 4.2
131
132
*/
132
133
public List <TriggerTask > getTriggerTaskList () {
133
- return (this .triggerTasks != null ? Collections .unmodifiableList (this .triggerTasks ) : null );
134
+ return (this .triggerTasks != null ? Collections .unmodifiableList (this .triggerTasks ) : Collections . emptyList () );
134
135
}
135
136
136
137
/**
@@ -140,7 +141,7 @@ public List<TriggerTask> getTriggerTaskList() {
140
141
public void setCronTasks (Map <Runnable , String > cronTasks ) {
141
142
this .cronTasks = new ArrayList <CronTask >();
142
143
for (Map .Entry <Runnable , String > task : cronTasks .entrySet ()) {
143
- this . addCronTask (task .getKey (), task .getValue ());
144
+ addCronTask (task .getKey (), task .getValue ());
144
145
}
145
146
}
146
147
@@ -156,10 +157,11 @@ public void setCronTasksList(List<CronTask> cronTasks) {
156
157
157
158
/**
158
159
* Get the cron tasks as an unmodifiable list of {@link CronTask} objects.
160
+ * @return the list of tasks (never {@code null})
159
161
* @since 4.2
160
162
*/
161
163
public List <CronTask > getCronTaskList () {
162
- return (this .cronTasks != null ? Collections .unmodifiableList (this .cronTasks ) : null );
164
+ return (this .cronTasks != null ? Collections .unmodifiableList (this .cronTasks ) : Collections . emptyList () );
163
165
}
164
166
165
167
/**
@@ -169,7 +171,7 @@ public List<CronTask> getCronTaskList() {
169
171
public void setFixedRateTasks (Map <Runnable , Long > fixedRateTasks ) {
170
172
this .fixedRateTasks = new ArrayList <IntervalTask >();
171
173
for (Map .Entry <Runnable , Long > task : fixedRateTasks .entrySet ()) {
172
- this . addFixedRateTask (task .getKey (), task .getValue ());
174
+ addFixedRateTask (task .getKey (), task .getValue ());
173
175
}
174
176
}
175
177
@@ -185,10 +187,11 @@ public void setFixedRateTasksList(List<IntervalTask> fixedRateTasks) {
185
187
186
188
/**
187
189
* Get the fixed-rate tasks as an unmodifiable list of {@link IntervalTask} objects.
190
+ * @return the list of tasks (never {@code null})
188
191
* @since 4.2
189
192
*/
190
193
public List <IntervalTask > getFixedRateTaskList () {
191
- return (this .fixedRateTasks != null ? Collections .unmodifiableList (this .fixedRateTasks ) : null );
194
+ return (this .fixedRateTasks != null ? Collections .unmodifiableList (this .fixedRateTasks ) : Collections . emptyList () );
192
195
}
193
196
194
197
/**
@@ -198,7 +201,7 @@ public List<IntervalTask> getFixedRateTaskList() {
198
201
public void setFixedDelayTasks (Map <Runnable , Long > fixedDelayTasks ) {
199
202
this .fixedDelayTasks = new ArrayList <IntervalTask >();
200
203
for (Map .Entry <Runnable , Long > task : fixedDelayTasks .entrySet ()) {
201
- this . addFixedDelayTask (task .getKey (), task .getValue ());
204
+ addFixedDelayTask (task .getKey (), task .getValue ());
202
205
}
203
206
}
204
207
@@ -214,18 +217,19 @@ public void setFixedDelayTasksList(List<IntervalTask> fixedDelayTasks) {
214
217
215
218
/**
216
219
* Get the fixed-delay tasks as an unmodifiable list of {@link IntervalTask} objects.
220
+ * @return the list of tasks (never {@code null})
217
221
* @since 4.2
218
222
*/
219
223
public List <IntervalTask > getFixedDelayTaskList () {
220
- return (this .fixedDelayTasks != null ? Collections .unmodifiableList (this .fixedDelayTasks ) : null );
224
+ return (this .fixedDelayTasks != null ? Collections .unmodifiableList (this .fixedDelayTasks ) : Collections . emptyList () );
221
225
}
222
226
223
227
/**
224
228
* Add a Runnable task to be triggered per the given {@link Trigger}.
225
229
* @see TaskScheduler#scheduleAtFixedRate(Runnable, long)
226
230
*/
227
231
public void addTriggerTask (Runnable task , Trigger trigger ) {
228
- this . addTriggerTask (new TriggerTask (task , trigger ));
232
+ addTriggerTask (new TriggerTask (task , trigger ));
229
233
}
230
234
231
235
/**
@@ -244,7 +248,7 @@ public void addTriggerTask(TriggerTask task) {
244
248
* Add a Runnable task to be triggered per the given cron expression
245
249
*/
246
250
public void addCronTask (Runnable task , String expression ) {
247
- this . addCronTask (new CronTask (task , expression ));
251
+ addCronTask (new CronTask (task , expression ));
248
252
}
249
253
250
254
/**
@@ -263,7 +267,7 @@ public void addCronTask(CronTask task) {
263
267
* @see TaskScheduler#scheduleAtFixedRate(Runnable, long)
264
268
*/
265
269
public void addFixedRateTask (Runnable task , long interval ) {
266
- this . addFixedRateTask (new IntervalTask (task , interval , 0 ));
270
+ addFixedRateTask (new IntervalTask (task , interval , 0 ));
267
271
}
268
272
269
273
/**
@@ -283,7 +287,7 @@ public void addFixedRateTask(IntervalTask task) {
283
287
* @see TaskScheduler#scheduleWithFixedDelay(Runnable, long)
284
288
*/
285
289
public void addFixedDelayTask (Runnable task , long delay ) {
286
- this . addFixedDelayTask (new IntervalTask (task , delay , 0 ));
290
+ addFixedDelayTask (new IntervalTask (task , delay , 0 ));
287
291
}
288
292
289
293
/**
0 commit comments