gpt4 book ai didi

Java Quartz 作业持久化

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:18:30 25 4
gpt4 key购买 nike

我对 Java Quartz 不太熟悉,我们只是使用了一个每天安排的测试工作。对于我们的 Struts2 web 应用程序,我们想要运行一些安排在一天中不同时间的日常工作。作业应该处于持久状态,这样即使作业由于服务器关闭/应用程序失败而失败,它们也应该稍后在服务器启动时重新执行。我还可以将作业的状态/结果存储在数据库中,以便监视作业。任何建议都会有所帮助。

--谢谢

最佳答案

无论您提到什么,在 Quartz 调度程序中都是可能的,并且已经有一个带有触发器的功能,我们通常称之为 Misfire Instructions这就是文档所说的

Another important property of a Trigger is its "misfire instruction". A misfire occurs if a persistent trigger "misses" its firing time because of the scheduler being shutdown, or because there are no available threads in Quartz's thread pool for executing the job. The different trigger types have different misfire instructions available to them. By default they use a 'smart policy' instruction - which has dynamic behavior based on trigger type and configuration. When the scheduler starts, it searches for any persistent triggers that have misfired, and it then updates each of them based on their individually configured misfire instructions. When you start using Quartz in your own projects, you should make yourself familiar with the misfire instructions that are defined on the given trigger types, and explained in their JavaDoc. More specific information about misfire instructions will be given within the tutorial lessons specific to each trigger type.

关于 Job 持久性 Quartz 几乎没有内置机制,您只需要将 JobStore 设置为 JDBCJobStore

我建议你选择Quartz scheduler document它非常简单,并且有很多教程和示例可以作为起点。

如果您没有在您的应用程序中使用 Spring,则无需添加额外的抽象级别和依赖项。

关于Java Quartz 作业持久化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11186201/

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