Generated by
JDiff

org.springframework.scheduling.annotation Documentation Differences

This file contains all the changes in documentation in the package org.springframework.scheduling.annotation as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class Async

Annotation that marks a method as a candidate for asynchronous execution. Can also be used at the type level, in which case all of the type's methods are considered as asynchronous.

In terms of target method signatures, any parameter types are supported. However, the return type is constrained to either {@code void} or java.util.concurrent.Future. In the latter case, the {@code Future} handle returned from the proxy will be an actual asynchronous {@code Future} that can be used to track the result of the asynchronous method execution. However, since the target method needs to implement the same signature, it will have to return a temporary {@code Future} handle that just passes the return value through: e.g. Spring's AsyncResult or EJB 3.1's javax.ejb.AsyncResult. @author Juergen Hoeller @author Chris Beams @since 3.0 @see org.springframework.aop.interceptor.AsyncExecutionInterceptor AnnotationAsyncExecutionInterceptor @see AsyncAnnotationAdvisor


Class AsyncAnnotationAdvisor

Advisor that activates asynchronous method execution through the Async annotation. This annotation can be used at the method and type level in implementation classes as well as in service interfaces.

This advisor detects the EJB 3.1 javax.ejb.Asynchronous annotation as well, treating it exactly like Spring's own Async. Furthermore, a custom async annotation type may get specified through the "asyncAnnotationType" property. @author Juergen Hoeller @since 3.0 @see org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor @see org.springframework.stereotype.Repository @see org.springframework.dao.DataAccessException @see org.springframework.dao.support.PersistenceExceptionTranslator

Class AsyncAnnotationAdvisor, constructor AsyncAnnotationAdvisor()

Create a new ConcurrencyAnnotationBeanPostProcessor{@code AsyncAnnotationAdvisor} for bean-style configuration.
Class AsyncAnnotationAdvisor, constructor AsyncAnnotationAdvisor(Executor)

Create a new ConcurrencyAnnotationBeanPostProcessor{@code AsyncAnnotationAdvisor} for the given task executor. @param executor the task executor to use for asynchronous methods
Class AsyncAnnotationAdvisor, Pointcut buildPointcut(Set<Class<Annotation>>)

Calculate a pointcut for the given targetasync classannotation types, if any. @param targetClassasyncAnnotationTypes the classasync annotation types to introspect @return the applicable Pointcut object, or null if none

Class EnableScheduling

Enables Spring's scheduled task execution capability, similar to functionality found in Spring's {@code } XML namespace. To be used on @Configuration classes as follows:
 @Configuration
 @EnableScheduling
 public class AppConfig {
     // various @Bean definitions
 }
This enables detection of @Scheduled annotations on any Spring-managed bean in the container. For example, given a class {@code MyTask}
 package com.myco.tasks;

 public class MyTask {
     @Scheduled(fixedRate=1000)
     public void work() {
         // task execution logic
     }
 }
the following configuration would ensure that {@code MyTask.work()} is called once every 1000 ms:
 @Configuration
 @EnableScheduling
 public class AppConfig {
     @Bean
     public MyTask task() {
         return new MyTask();
     }
 }
Alternatively, if {@code MyTask} were annotated with {@code @Component}, the following configuration would ensure that its {@code @Scheduled} method is invoked at the desired interval:
 @Configuration
 @ComponentScan(basePackages="com.myco.tasks")
 public class AppConfig {
 }
Methods annotated with {@code @Scheduled} may even be declared directly within {@code @Configuration} classes:
 @Configuration
 @EnableScheduling
 public class AppConfig {
     @Scheduled(fixedRate=1000)
     public void work() {
         // task execution logic
     }
 }
In all of the above scenarios, a default single-threaded task executor is used. When more control is desired, a {@code @Configuration} class may implement SchedulingConfigurer. This allows access to the underlying ScheduledTaskRegistrar instance. For example, the following example demonstrates how to customize the Executor used to execute scheduled tasks:
 @Configuration
 @EnableScheduling
 public class AppConfig implements SchedulingConfigurer {
     @Override
     public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
         taskRegistrar.setScheduler(taskExecutor());
     }

     @Bean
Bean(destroyMethod="shutdown")
     public Executor taskExecutor() {
         return Executors.newScheduledThreadPool(100);
     }
 }
Note in the example above the use of {@code @Bean(destroyMethod="shutdown")}. This ensures that the task executor is properly shut down when the Spring application context itself is closed. Implementing {@code SchedulingConfigurer} also allows for fine-grained control over task registration via the {@code ScheduledTaskRegistrar}. For example, the following configures the execution of a particular bean method per a custom {@code Trigger} implementation:
 @Configuration
 @EnableScheduling
 public class AppConfig implements SchedulingConfigurer {
     @Override
     public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
         taskRegistrar.setScheduler(taskScheduler());
         taskRegistrar.addTriggerTask(
             new Runnable() {
                 public void run() {
                     myTask().work();
                 }
             },
             new CustomTrigger()
         );
     }

     @Bean
Bean(destroyMethod="shutdown")
     public Executor taskScheduler() {
         return Executors.newScheduledThreadPool(42);
     }

     @Bean
     public MyTask myTask() {
         return new MyTask();
     }
 }

For reference, the example above can be compared to the following Spring XML configuration:

 {@code
 
     
     
     
     
 
 }
the examples are equivalent save that in XML a fixed-rate period is used instead of a custom {@code Trigger} implementation; this is because the {@code task:} namespace {@code scheduled} cannot easily expose such support. This is but one demonstration how the code-based approach allows for maximum configurability through direct access to actual componentry.

@author Chris Beams @since 3.1 @see Scheduled @see SchedulingConfiguration @see SchedulingConfigurer @see ScheduledTaskRegistrar @see Trigger @see ScheduledAnnotationBeanPostProcessor


Class Scheduled

Annotation that marks a method to be scheduled. Exactly one of the .cron(), .fixedDelay(), or .fixedRate() attributes must be providedspecified.

The annotated method must expect no arguments and have a {@code void} return type.

Processing of {@code @Scheduled} annotations is performed by registering a ScheduledAnnotationBeanPostProcessor. This can be done manually or, more conveniently, through the {@code } element or @EnableScheduling annotation. @author Mark Fisher @author Dave Syer @author Chris Beams @since 3.0 @see EnableScheduling @see ScheduledAnnotationBeanPostProcessor


Class SchedulingConfigurer

InterfaceOptional interface to be implemented by @org.springframework.context.annotation.Configuration classes annotatedannotated with @EnableScheduling. Typically used thatfor setting a specific TaskScheduler wishbean to registerbe used when executing scheduled tasks or for registering scheduled tasks tasks in a programmatic fashion as opposed to the declarative approach of of using the @Scheduled annotation. For example, this may be necessary when when implementing Trigger-based tasks, which which are not supported byby the {@code @Scheduled} annotation.

See @EnableScheduling for detailed usage examples. @author Chris Beams @since 3.1 @see EnableScheduling @see ScheduledTaskRegistrar