类 ScheduledAnnotationBeanPostProcessor
- 所有已实现的接口:
Aware,BeanFactoryAware,BeanNameAware,BeanPostProcessor,DestructionAwareBeanPostProcessor,DisposableBean,InitializationBeanPostProcessor,SmartInitializingSingleton,MergedBeanDefinitionPostProcessor,ApplicationListener<ContextRefreshedEvent>,ApplicationContextAware,EmbeddedValueResolverAware,cn.taketoday.core.Ordered,ScheduledTaskHolder,EventListener
@Scheduled to be invoked by a
TaskScheduler according to the
"fixedRate", "fixedDelay", or "cron" expression provided via the annotation.
This post-processor is automatically registered by
<task:annotation-driven> XML element, and also by the
@EnableScheduling annotation.
Autodetects any SchedulingConfigurer instances in the container,
allowing for customization of the scheduler to be used or for fine-grained
control over task registration (e.g. registration of Trigger tasks).
See the @EnableScheduling javadocs for complete usage
details.
- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Juergen Hoeller, Chris Beams, Elizabeth Chatman, Victor Brown, Sam Brannen
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final StringThe default name of theTaskSchedulerbean to pick up: "taskScheduler".从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器构造器说明Create a defaultScheduledAnnotationBeanPostProcessor.Create aScheduledAnnotationBeanPostProcessordelegating to the specifiedScheduledTaskRegistrar. -
方法概要
修饰符和类型方法说明voidprotected RunnablecreateRunnable(Object target, Method method) Create aRunnablefor the given bean instance, calling the specified scheduled method.voiddestroy()intgetOrder()Return all currently scheduled tasks, fromScheduledmethods as well as from programmaticSchedulingConfigurerinteraction.voidHandle an application event.postProcessAfterInitialization(Object bean, String beanName) voidpostProcessBeforeDestruction(Object bean, String beanName) postProcessBeforeInitialization(Object bean, String beanName) voidpostProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Object bean, String beanName) protected voidprocessScheduled(Scheduled scheduled, Method method, Object bean) Process the given@Scheduledmethod declaration on the given bean.booleanrequiresDestruction(Object bean) voidsetApplicationContext(ApplicationContext applicationContext) Setting anApplicationContextis optional: If set, registered tasks will be activated in theContextRefreshedEventphase; if not set, it will happen atafterSingletonsInstantiated()time.voidsetBeanFactory(BeanFactory beanFactory) Making aBeanFactoryavailable is optional; if not set,SchedulingConfigurerbeans won't get autodetected and aschedulerhas to be explicitly configured.voidsetBeanName(String beanName) voidsetEmbeddedValueResolver(cn.taketoday.core.StringValueResolver resolver) Set the StringValueResolver to use for resolving embedded definition values.voidsetScheduler(Object scheduler) Set theTaskSchedulerthat will invoke the scheduled methods, or aScheduledExecutorServiceto be wrapped as a TaskScheduler.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.beans.factory.support.MergedBeanDefinitionPostProcessor
resetBeanDefinition
-
字段详细资料
-
DEFAULT_TASK_SCHEDULER_BEAN_NAME
The default name of theTaskSchedulerbean to pick up: "taskScheduler".Note that the initial lookup happens by type; this is just the fallback in case of multiple scheduler beans found in the context.
- 另请参阅:
-
-
构造器详细资料
-
ScheduledAnnotationBeanPostProcessor
public ScheduledAnnotationBeanPostProcessor()Create a defaultScheduledAnnotationBeanPostProcessor. -
ScheduledAnnotationBeanPostProcessor
Create aScheduledAnnotationBeanPostProcessordelegating to the specifiedScheduledTaskRegistrar.- 参数:
registrar- the ScheduledTaskRegistrar to register@Scheduledtasks on
-
-
方法详细资料
-
getOrder
public int getOrder()- 指定者:
getOrder在接口中cn.taketoday.core.Ordered
-
setScheduler
Set theTaskSchedulerthat will invoke the scheduled methods, or aScheduledExecutorServiceto be wrapped as a TaskScheduler.If not specified, default scheduler resolution will apply: searching for a unique
TaskSchedulerbean in the context, or for aTaskSchedulerbean named "taskScheduler" otherwise; the same lookup will also be performed for aScheduledExecutorServicebean. If neither of the two is resolvable, a local single-threaded default scheduler will be created within the registrar. -
setEmbeddedValueResolver
public void setEmbeddedValueResolver(cn.taketoday.core.StringValueResolver resolver) 从接口复制的说明:EmbeddedValueResolverAwareSet the StringValueResolver to use for resolving embedded definition values. -
setBeanName
- 指定者:
setBeanName在接口中BeanNameAware
-
setBeanFactory
Making aBeanFactoryavailable is optional; if not set,SchedulingConfigurerbeans won't get autodetected and aschedulerhas to be explicitly configured.- 指定者:
setBeanFactory在接口中BeanFactoryAware
-
setApplicationContext
Setting anApplicationContextis optional: If set, registered tasks will be activated in theContextRefreshedEventphase; if not set, it will happen atafterSingletonsInstantiated()time.- 指定者:
setApplicationContext在接口中ApplicationContextAware- 参数:
applicationContext- the ApplicationContext object to be used by this object- 另请参阅:
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated() -
onApplicationEvent
从接口复制的说明:ApplicationListenerHandle an application event.- 指定者:
onApplicationEvent在接口中ApplicationListener<ContextRefreshedEvent>- 参数:
event- the event to respond to
-
postProcessMergedBeanDefinition
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Object bean, String beanName) -
postProcessBeforeInitialization
-
postProcessAfterInitialization
-
processScheduled
Process the given@Scheduledmethod declaration on the given bean.- 参数:
scheduled- the@Scheduledannotationmethod- the method that the annotation has been declared onbean- the target bean instance- 另请参阅:
-
createRunnable
Create aRunnablefor the given bean instance, calling the specified scheduled method.The default implementation creates a
ScheduledMethodRunnable.- 参数:
target- the target bean instancemethod- the scheduled method to call- 另请参阅:
-
getScheduledTasks
Return all currently scheduled tasks, fromScheduledmethods as well as from programmaticSchedulingConfigurerinteraction.- 指定者:
getScheduledTasks在接口中ScheduledTaskHolder
-
postProcessBeforeDestruction
-
requiresDestruction
-
destroy
public void destroy()- 指定者:
destroy在接口中DisposableBean
-