问题描述
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 Instructions
this 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 作业持久化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!