javaquartz调度作业-作业停止运行

46scxncf  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(336)

我有一个java服务,其中我使用quartz进行作业调度。
最近我遇到了一些问题,在某些时候,调度程序只是停止运行。例如,我有每分钟都应该运行的作业,但我看到它们不运行的时间增量为10分钟。我的quartzscheduler类:

public class QuartzListener extends QuartzInitializerListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {

        super.contextInitialized(sce);
        ServletContext ctx = sce.getServletContext();
        StdSchedulerFactory factory = (StdSchedulerFactory) ctx.getAttribute(QUARTZ_FACTORY_KEY);

        try {
            // Create the triggers
            Trigger UpdateFileTrigger = TriggerBuilder.newTrigger().withIdentity("UpdateFileTrigger").
                    withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMinutes(20).repeatForever()).startNow().build();
            Trigger moStartAutoTrigger = TriggerBuilder.newTrigger().withIdentity("StartAutoTrigger").
                    withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMinutes(1).repeatForever()).startNow().build();
            Trigger moCheckAutoTrigger = TriggerBuilder.newTrigger().withIdentity("CheckAutoTrigger").
                    withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMinutes(1).repeatForever()).startNow().build();

            JobDetail uploadVMMFile = JobBuilder.newJob(UploadVMMFile.class).build();
            JobDetail moCreateInstance = JobBuilder.newJob(MoCreateInstanceJob.class).build();
            JobDetail moAttachVolumes = JobBuilder.newJob(MoAttachVolumesJob.class).build();

            Scheduler scheduler = factory.getScheduler();
            scheduler.scheduleJob(uploadVMMFile,UpdateFileTrigger);
            scheduler.scheduleJob(moCreateInstance, moStartAutoTrigger);
            scheduler.scheduleJob(moAttachVolumes, moCreateInstance);

            scheduler.start();
        } catch (SchedulerException e) {
            e.printStackTrace();
        }
    }
}

在我的日志中我看到一些重复的错误。我试过研究它们,但似乎找不到重要的意义:

org.quartz.simpl.SimpleThreadPool##anonymous#DefaultQuartzScheduler_Worker-9#na#application#scheduleservice#web##na#na#na#na#Worker thread was interrupt()'ed. java.lang.InterruptedException: null
at java.lang.Object.wait(Native Method)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)

ERROR#se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventor##anonymous#localhost-startStop-2#na#application#scheduleservice#web##na#na#na#na#ClassLoaderLeakPreventor: Stopping Thread 'Thread[DefaultQuartzScheduler_Worker-9,5,main]' of type org.quartz.simpl.SimpleThreadPool$WorkerThread running in web app after 5000 ms

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题