当Quartz作业运行时,Spring终止上下文

时间:2012-09-18 10:13:44

标签: java spring quartz-scheduler

我创建Quartz作业并启动调度程序

JobDetail job = newJob(InfoCrawlerJob.class)
                        .withIdentity("job id", "group")
                        .usingJobData(jobData)
                        .build()

                SimpleTrigger trigger = newTrigger()
                        .withIdentity("trigger id", "trigger-group")
                        .startNow()
                        .withSchedule(simpleSchedule()
                        .withIntervalInSeconds(100)
                        .withRepeatCount(10))
                        .build()

                scheduler.scheduleJob(job, trigger)
                scheduler.start()

Quartz的工作正在发挥作用。主要问题是Spring不等待工作完成。我该如何解决?

1 个答案:

答案 0 :(得分:0)