开发者

How to create a custom Quartz trigger?

I searched google but couldn't find articles/tutorials on how t开发者_StackOverflow中文版o create a custom trigger. Any pointers/suggestions are helpful. The custom trigger should wait until the below two conditions are met and then trigger a job

  1. Time is past 5 PM
  2. A record with particular value (say a column value for row id 10 is changed to "START") has arrived in a given table


I agree with sjr. I would just create a CronTrigger with cronExpression 0 0/5 17-23 * * ? (so it would fire every 5 minutes starting at 5 PM - adjust the frequency depending on your exact requirements) , and then check the database conditions upon job execution.


Disclaimer: I haven't used Quartz before, but looking at the javadoc Trigger looks hard enough to implement. Can't you just run your job every minute or hour or whatever and put something like the following up the top:

if (!new org.joda.time.DateTime().getHourOfDay() >= 17 || !databaseRowIsInPlace()) {
    return;
}

// Do complicated work
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜