diff --git a/framework-docs/modules/ROOT/pages/integration/scheduling.adoc b/framework-docs/modules/ROOT/pages/integration/scheduling.adoc index eae7ff2e70..ee08e1a9f4 100644 --- a/framework-docs/modules/ROOT/pages/integration/scheduling.adoc +++ b/framework-docs/modules/ROOT/pages/integration/scheduling.adoc @@ -380,6 +380,12 @@ Notice that the methods to be scheduled must have void returns and must not acce arguments. If the method needs to interact with other objects from the application context, those would typically have been provided through dependency injection. +`@Scheduled` can be used as a repeatable annotation. If several scheduled declarations +are found on the same method, each of them will be processed independently, with a +separate trigger firing for each of them. As a consequence, such co-located schedules +may overlap and execute multiple times in parallel or in immediate succession. +Please make sure that your specified cron expressions etc do not accidentally overlap. + [NOTE] ==== As of Spring Framework 4.3, `@Scheduled` methods are supported on beans of any scope. diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java index a202e7846b..41e88d3f50 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java @@ -29,8 +29,8 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; /** * Annotation that marks a method to be scheduled. Exactly one of the - * {@link #cron}, {@link #fixedDelay}, or {@link #fixedRate} attributes must be - * specified. + * {@link #cron}, {@link #fixedDelay}, or {@link #fixedRate} attributes + * must be specified. * *
The annotated method must expect no arguments. It will typically have * a {@code void} return type; if not, the returned value will be ignored @@ -42,7 +42,10 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; * XML element or {@link EnableScheduling @EnableScheduling} annotation. * *
This annotation can be used as a {@linkplain Repeatable repeatable} - * annotation. + * annotation. If several scheduled declarations are found on the same method, + * each of them will be processed independently, with a separate trigger firing + * for each of them. As a consequence, such co-located schedules may overlap + * and execute multiple times in parallel or in immediate succession. * *
This annotation may be used as a meta-annotation to create custom * composed annotations with attribute overrides.