Create a servlet that starts with the init web application.
<web-app>
...
<servlet>
<servlet-name>Emailer</servlet-name>
<servlet-class>my.servlet.Emailer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
...
</web-app>
init() ( 10 )
SchedulerFactory schFact = new org.quartz.impl.StdSchedulerFactory();
Scheduler sched = schFact.getScheduler();
JobDetail job = new JobDetail("job1", "group1", EmailerJob.class);
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1", "group1", "* 0/10 * * * ?");
sched.addJob(job, true);
sched.start();
, Quartz.
EmailerJob implement Job{
public void execute(JobExecutionContext arg0) throws JobExecutionException {
}
}
P.S. , , .
@jmort253 , Quartz - , , , - .
, Google . , ! Java - - API
# 1 ContextListener .
1
@jhouse , , Job, , SendMailJob Quartz . @jhouse.