Currently i am using quartz scheduler in my application for executing scheduler. My application is running on a tomcat server. If the server was started then the scheduler will start firing the task based on the start time provided.
My problem is if the task was scheduled to execute in interval basis for every 10 minutes and the tomcat was stopped for some reasons and it was resumed back after some two days then the quartz scheduler expression to get the nextvalid time is taking based on the start time provided, hence the scheduler jobs was back dated jobs..
Real time example :
The task was set to interval with the below cron expression for every 10 minutes.
0 0/10 * 1/1 * ? *
The start time for the job was
"2017-04-08 21:46:00"
But the application/tomcat server was started only on 10th april and after executing the scheduler the start time was changed to below format
"2017-04-08 21:56:00"
Only the time was incremented to 10 minutes and the date was not changed to 10th of April(today).
Currently i am using the below code to fetch the next date/time for the scheduler
CronExpression exp = new CronExpression(schedulerConfig.getCronexpression());
NextschedulerDate = exp.getNextValidTimeAfter(Currentstartdate);
The same case is not working for weekday option. Kindly assist