摘要
在Web应用中,经常需要将某个工作安排在某个特定时间点去做。Spring提供了丰富多样的任务执行调度,包括使用JDK Timer、使用SchedulingTaskExecutor接口的实现类、使用Quartz、使用TaskScheduler以及采用@Scheduled注解等多种形式。研究得出,JDK Timer仅支持简单的间隔定时执行;SchedulingTaskExecutor接口的实现类提供了并发任务的各类执行方式;Quartz和TaskScheduler支持基于Cron表达式的定时调度,后者还可通过@Scheduled注解定义任务定时。
Some tasks in web applications are often arranged in a special time. Spring provides various ways for task scheduling such as using by JDK Timer,by the concrete class which implements SchedulingTaskExecutor interface,by Quartz,by TaskScheduler, and by the annotation named @Scheduled.The paper studies and achieves that JDK Timer only supports simple Interval timing task;the concrete class of SchedulingTaskExecutor provides many kinds of execute mode for concurrent task. In additon,Quartz and TaskScheduler support time scheduling with Cron expression, and the latter also supports the definition of @Scheduled annotation.
出处
《智能计算机与应用》
2012年第4期55-56,60,共3页
Intelligent Computer and Applications