Seeing your discussion I guess you know how to use crons. I get into troubles with cron in my code and do not find any answer. Please would you mind telling me what I am doing wrong: this morning at 9.30am I was launching a cron that should execute a job at 9.45am. This cron is writing "Execution Job" in my log file.
However nothing is written in my log file while doing this:
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
// define the job and tie it to our EthicFlow_CreatePersonJob class
JobDetail job = new JobDetail("EthicFlow_CreatePersonJob", "group1", EthicFlow_CreatePersonJob.class);
Date runTime = TriggerUtils.getDateOf(0,45,9,22,8,2006);
SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1", runTime);
sched.scheduleJob(job, trigger);
sched.start();
Thread.sleep(90L * 1000L);
sched.shutdown(true);
With the execution job:
protected void executeInternal(JobExecutionContext ctx)
throws JobExecutionException {
// do the actual work
logger.info("Execution Job");
}
If I launch the cron almost at the same time as the set runtime that is working but if the cron has to be executed 10min later that does not seem to work. What do I do wrong here?
Thanks in advance for your help.