I'm not sure what the best way to initialize Quartz is to schedule cron to work. My environment is Tomcat. I have one task that needs to be run every day.
Should I create a separate servlet to initialize the quartz and the schedule of my work?
I think about creating a servlet and in init () I plan my work 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 it seems to me that I always need to maintain a link to SchedulerFactory for Quartz to work, so is there a better option on the servlet?
source share