JavaQuartz 作业持久化 [英] JavaQuartz Job persistence

查看:35
本文介绍了JavaQuartz 作业持久化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am not much familiar with Java Quartz, we just used a test job thats scheduled daily. For our Struts2 webapplication, we want to run a few daily jobs that are scheduled at different times of the day. The jobs should be in persistence state such that even if the jobs fails due to server down/application failed, they should re-execute later when server is up. Also can i store the status/results of the jobs in DB, so as to monitor the jobs. Any suggestions would be helpful.

-- Thanks

解决方案

Whatever you have mentioned is possible in Quartz scheduler and there is already a feature with triggers which we generally call Misfire Instructionsthis is what doc say about it

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.

Regarding Job persistence Quartz comes with few build in mechanism and all you need to set JobStore as JDBCJobStore

I suggest you to go with Quartz scheduler document its quite easy and have lots of tutorial and examples to start with.

If you are not using Spring in your application there is no need to add extra level of abstraction and dependencies.

这篇关于JavaQuartz 作业持久化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆