I'm not really sure what is the best way to initialize Quartz to schedule a cron job. My environment is just Tomcat. I just have one job that needs to be triggered every day.
Should I create a separate Servlet just to initalize Quartz and schedule my job?
I'm thinking of creating a Servlet and on the init() schedule my job something like this:
SchedulerFactory sf=new StdSchedulerFactory();
Scheduler sched=sf.getScheduler();
JobDetail jd=new JobDetail("job1","group1",CronJob.class);
CronTrigger ct=new CronTrigger("cronTrigger","group2","0 0/1 * * * ?");
sched.scheduleJob(jd,ct);
sched.start();
I'm new to Quartz but I guess I always need to keep a reference to the SchedulerFactory in order for Quartz to be running, therefore having that on a Servlet will be best option?