gpt4 book ai didi

quartz-scheduler - 如何使用 Quartz XML 插件声明一次性简单触发器?

转载 作者:行者123 更新时间:2023-12-04 20:51:02 24 4
gpt4 key购买 nike

我正在尝试设置一个作业,使其在我的调度程序第一次启动时运行一次,然后在每天午夜运行一次。这是我的作业和触发器的 XML。一天一次触发有效,但一次性触发无效。

    <job>
<name>MyJob</name>
<group>MyJobGroup</group>
<job-type>MyScheduledJob, MyJobAssembly</job-type>
<description>My job, yo</description>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>MyTrigger</name>
<group>MyTriggerGroup</group>
<job-name>MyJob</job-name>
<job-group>MyJobGroup</job-group>
<cron-expression>0 0 0 1/1 * ? *</cron-expression>
</cron>
<simple>
<name>MyOneTimeTrigger</name>
<group>MyTriggerGroup</group>
<description>Run once at startup, G</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>MyJob</job-name>
<job-group>MyJobGroup</job-group>
<repeat-count>0</repeat-count>
<repeat-interval>0</repeat-interval>
</simple>
</trigger>

最佳答案

通过不起作用我猜你的意思是触发器永远不会触发。也许是因为它没有延迟它会失火?添加<start-time-seconds-in-future/>怎么样? future 一段时间?

<simple>
<name>MyOneTimeTrigger</name>
<group>MyTriggerGroup</group>
<description>Run once at startup, G</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>MyJob</job-name>
<job-group>MyJobGroup</job-group>
<start-time-seconds-in-future>60</start-time-seconds-in-future>
<repeat-count>0</repeat-count>
<repeat-interval>0</repeat-interval>
</simple>

如果它对你有用,你必须知道一些你可能认为是错误或功能的东西:如果你重新启动服务器,因为触发器已经触发并被删除,它会再次触发。见: Quartz XML plugin reschedules fired triggers after restart .

关于quartz-scheduler - 如何使用 Quartz XML 插件声明一次性简单触发器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10687304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com