I have the following situation:
8 tasks scheduled to run with org.quartz.threadPool.threadCount
set to 5.
But in reality I can see that all 8 tasks are running.
How this could be possible?
If I set org.quartz.threadPool.threadCount=5
and I submitted 10 tasks for quartz, it is true that only 5 tasks will run in parallel?
What is the meaning of org.quartz.threadPool.threadCount
property?
I have such design:
- We have some tasks that do some work on entities in db
- We have special JobRunner that executes one task
- We scan for tasks to run and schedule task for running in quartz service that is configured with SchedulerFactoryBean with
org.quartz.threadPool.threadCount
set to 5. - As i understand if quartz service with SchedulerFactoryBean will have 5 tasks running and if we will try to schedule additional task quartz itself should throw an Exception. Is this true?
Thanks.
Best Solution
It's true that QUARTZ's org.quartz.threadPool.threadCount is only the max number of concurrent/parallel execution.
That means that if you schedule X jobs greater than threadCount then K = X - threadCount jobs will wait at most a misFired milliseconds in some kind of queue for threadCount jobs to finish.
Thus Total number of scheduled jobs (or task) may be Number of waiting task in queue + Number of running task. With Number of running task less or equal to threadCount.