Thursday, 15 September 2011

java - Scheduled task to run every 3 days at given time -


I am using Quartz 2 scheduler for scheduling tasks. What I want down

  1. Set the job time when the user clicks on a button.
  2. The job should be set to run at 8 a.m. every morning.

Below I've coded it. User will be able to execute it after clicking on a button in the web application)

  trigger passport trigger 1 = new trigger () .withIdentity (passportTriggerKey1) interverInHours with .withSchedule (simple (optional) 24) .repeat foreverver ()). Start at (today (8,0,0)) Build ();  

However you can see that I've used the startAt (today (8,0,0,0,0)) . What if the user starts the scheduler after 8.00? Will the work be determined immediately or will it never be determined?

You can also check the current time: if it is before <8> Today (8, 0, 0) else startAt (yesterday (8, 0, 0)) .


No comments:

Post a Comment