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 =
|
String errorMessage =
|
||||||
"Exactly one of the 'cron', 'fixedDelay(String)', or 'fixedRate(String)' attributes is required";
|
"Exactly one of the 'cron', 'fixedDelay(String)', or 'fixedRate(String)' attributes is required";
|
||||||
|
|
||||||
Set<ScheduledTask> tasks =
|
Set<ScheduledTask> tasks = this.scheduledTasks.get(bean);
|
||||||
new LinkedHashSet<ScheduledTask>(4);
|
if (tasks == null) {
|
||||||
|
tasks = new LinkedHashSet<ScheduledTask>(4);
|
||||||
|
this.scheduledTasks.put(bean, tasks);
|
||||||
|
}
|
||||||
|
|
||||||
// Determine initial delay
|
// Determine initial delay
|
||||||
long initialDelay = scheduled.initialDelay();
|
long initialDelay = scheduled.initialDelay();
|
||||||
|
|
@ -397,7 +400,6 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
|
||||||
|
|
||||||
// Check whether we had any attribute set
|
// Check whether we had any attribute set
|
||||||
Assert.isTrue(processedSchedule, errorMessage);
|
Assert.isTrue(processedSchedule, errorMessage);
|
||||||
this.scheduledTasks.put(bean, tasks);
|
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue