• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with Quartz's Cron Expression

 
Ranch Hand
Posts: 100
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am using quartz as the scheduler for one of my application and using CronTrigger with CronExpression to schedule my jobs.
I had a scenario where I had a run a job and repeat it every time interval(say 40 min) on all days starting from the time it is triggered. So, I was using an expression like "0 0/40 * * * ?" .
However, now I am looking for a little different use case. I want to run and repeat a job between a start and end time window of the day. Suppose between 2.30 - 4.10 every day and repeats at an interval of 40 min.
i.e, trigger should get fired at 2.30, 3.10, 3.50
Can someone let me know if such a scenario can be achieved through cron expression in quartz?
I have gone through lots of docs and tutorials on quartz and cron expression but couldn't find a way of achieving this.
http://www.quartz-scheduler.org/docs/tutorial/TutorialLesson06.html
http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html

One thing that I seem to understand from the docs is that cron is only to trigger/fire a job at a particular min in every hour (like run a job at 5th min, 10th min etc. every hour or at 5th, 10th, 15th hour etc.) but you cannot use it start a job at a particular min in an hour and end at a different min in another hour. Is that true or can I do what I need using cron expressions?

One thought/workaround that I could think for my use case is to create three different triggers :
one for scheduling from 2.30-3.00(for the partial hour at start)
one for 3.00-4.00(for the full hours)
and one for 4.00-4.10( for the partial hour at end).
However, with these 3 triggers, it does not give the continuity in the intervals. i.e, the trigger would run at 2.30, again at 3.00 and 3.40 and at 4.00.
Instead of the 2.30, 3.10, 3.50 that I actually needed.

Any help is greatly appreciated . Thanks.

Posted it in quartz forums as well since that is dedicated to quartz . http://forums.terracotta.org/forums/posts/list/5665.page
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic