如何在 Quartz 中安排一个永远重复的工作?
是否有可能以串行方式永远重复 Quartz 中的作业?
现在,如果我不设置 RepeatInterval,则会收到一条错误消息,指出 RepeatInterval 不能为零。
是否可以使用 Spring.NET 进行配置?我现在所拥有的是:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<object id="ExampleBusinessObject" type="Edu3.Core.Job.ExampleJob, Edu3.Core"/>
<object id="JobDetail"
type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject,
Spring.Scheduling.Quartz">
<property name="TargetObject" ref="ExampleBusinessObject" />
<property name="TargetMethod" value="DoIt" />
<property name="Concurrent" value="false" />
</object>
<object id="SimpleTrigger"
type="Spring.Scheduling.Quartz.SimpleTriggerObject,
Spring.Scheduling.Quartz">
<!-- see the example of method invoking job above -->
<property name="JobDetail" ref="JobDetail" />
<!-- 10 seconds -->
<!--<property name="StartDelay" value="5s" />-->
<!-- repeat every 50 seconds -->
<property name="RepeatInterval" value="10s" />
</object>
<object id="quartzSchedulerFactory"
type="Spring.Scheduling.Quartz.SchedulerFactoryObject,
Spring.Scheduling.Quartz">
<property name="triggers">
<list>
<ref object="SimpleTrigger" />
</list>
</property>
</object>
</objects>
我不希望不同的线程执行相同的作业。我只想触发 DoIt。如果DoIt完成,则再次触发DoIt。就像一个不定式 while 循环。
Is it possible to repeat a job in Quartz forever in a serial way?
Now, if I don't set RepeatInterval I get an error saying that RepeatInterval cannot be zero.
Is it possible to configure this using Spring.NET? What I have now is this:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<object id="ExampleBusinessObject" type="Edu3.Core.Job.ExampleJob, Edu3.Core"/>
<object id="JobDetail"
type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject,
Spring.Scheduling.Quartz">
<property name="TargetObject" ref="ExampleBusinessObject" />
<property name="TargetMethod" value="DoIt" />
<property name="Concurrent" value="false" />
</object>
<object id="SimpleTrigger"
type="Spring.Scheduling.Quartz.SimpleTriggerObject,
Spring.Scheduling.Quartz">
<!-- see the example of method invoking job above -->
<property name="JobDetail" ref="JobDetail" />
<!-- 10 seconds -->
<!--<property name="StartDelay" value="5s" />-->
<!-- repeat every 50 seconds -->
<property name="RepeatInterval" value="10s" />
</object>
<object id="quartzSchedulerFactory"
type="Spring.Scheduling.Quartz.SchedulerFactoryObject,
Spring.Scheduling.Quartz">
<property name="triggers">
<list>
<ref object="SimpleTrigger" />
</list>
</property>
</object>
</objects>
I don't want different threads executing the same job. I just want DoIt to be triggered. If DoIt is finished, then DoIt is triggered again. Like a infinitive while loop.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“重复计数”设置为“-1”
'RepeatCount' set to '-1'