以下是一些僞代碼,您可以進行測試並得到諒解運行。
public class QuartzTest {
public static void main(String[] args) {
try {
// Grab the Scheduler instance from the Factory
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
JobDetail job = newJob(HelloWord1.class)
.withIdentity("job1", "group1")
.build();
// Trigger the job to run now, and then repeat every 40 seconds
Trigger trigger = newTrigger()
.withIdentity("trigger1", "group1")
.startNow()
.withSchedule(simpleSchedule()
.withIntervalInSeconds(40)
.repeatForever())
.build();
// Tell quartz to schedule the job using our trigger
scheduler.start();
scheduler.scheduleJob(job, trigger);
scheduler.shutdown();
} catch (SchedulerException se) {
se.printStackTrace();
}
}
}
什麼是錯誤您收到? – Xinus