我遵循了该教程:http ://www.mkyong.com/spring/spring-quartz-scheduler-example/
我的配置文件如下:
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="runMeTask" class="com.mkyong.common.RunMeTask" />
<!-- Spring Quartz -->
<bean id="runMeJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="runMeTask" />
<property name="targetMethod" value="printMe" />
</bean>
<!-- Cron Trigger, run every 5 seconds -->
<bean id="cronTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="runMeJob" />
<property name="cronExpression" value="0/5 * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="jobDetails">
<list>
<ref bean="runMeJob" />
</list>
</property>
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
我的 printMe 函数每 5 秒调用一次。但是,如果该功能发生一些延迟,我会看到下一个作业已排队。然而我不想要它。我怎么能在春天做到这一点?