I want my application to run no more than five tasks at the same time, the others queued up and started only after any of the five working threads are released. Here is my code:

SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory("quartz.properties"); sched = schedFact.getScheduler(); sched.start(); String jobName = generateJobDetailName(); JobDetail jobDetail = new JobDetail(jobName, GRP_Immediate, MyJob.class); jobDetail.getJobDataMap().put(MyJob.DATA, data); Trigger trigger = TriggerUtils.makeImmediateTrigger(0, 0); trigger.setName(jobName + "_Simpletrigger"); sched.scheduleJob(jobDetail, trigger); 

And the quartz.properties settings quartz.properties :

 org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 5 org.quartz.threadPool.threadPriority = 5 

But I can not understand what misfire instructions ( misfire instructions ) I have to set to achieve this goal. And what misfire threshold? I would also be grateful for any links to documentation / reference books in Russian relating to this topic!

    1 answer 1

    The required behavior was achieved after adding the line to the quartz.properties file:

     org.quartz.jobStore.misfireThreshold=1 

    and in the line code:

     trigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW);