ScheduledAnnotationBeanPostProcessor properly registers multiple tasks per bean
Issue: SPR-14286
This commit is contained in:
parent
24f5f368b0
commit
3576ff051c
|
|
@ -302,8 +302,11 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
|
|||
String errorMessage =
|
||||
"Exactly one of the 'cron', 'fixedDelay(String)', or 'fixedRate(String)' attributes is required";
|
||||
|
||||
Set<ScheduledTask> tasks =
|
||||
new LinkedHashSet<ScheduledTask>(4);
|
||||
Set<ScheduledTask> tasks = this.scheduledTasks.get(bean);
|
||||
if (tasks == null) {
|
||||
tasks = new LinkedHashSet<ScheduledTask>(4);
|
||||
this.scheduledTasks.put(bean, tasks);
|
||||
}
|
||||
|
||||
// Determine initial delay
|
||||
long initialDelay = scheduled.initialDelay();
|
||||
|
|
@ -397,7 +400,6 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
|
|||
|
||||
// Check whether we had any attribute set
|
||||
Assert.isTrue(processedSchedule, errorMessage);
|
||||
this.scheduledTasks.put(bean, tasks);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
throw new IllegalStateException(
|
||||
|
|
|
|||
Loading…
Reference in New Issue