Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz scheduler max thread count property

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:

  1. We have some tasks that do some work on entities in db
  2. We have special JobRunner that executes one task
  3. 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.
  4. 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.

like image 586
breedish Avatar asked Jan 24 '12 12:01

breedish


People also ask

What is thread count in quartz?

org.quartz.threadPool.threadCount Can be any positive integer, although you should realize that only numbers between 1 and 100 are very practical. This is the number of threads that are available for concurrent execution of jobs. If you only have a few jobs that fire a few times a day, then 1 thread is plenty!

Why should we use Quartz scheduler?

Quartz scheduler allows an enterprise to schedule a job at a specified date and time. It allows us to perform the operations to schedule or unschedule the jobs. It provides operations to start or stop or pause the scheduler. It also provides reminder services.

What is org quartz threadPool threadCount?

It provides a fixed-size pool of threads that "live" the lifetime of the Scheduler. org.quartz.threadPool.threadCount. This specifies the number of threads that are available for concurrent execution of jobs. It can be set to a positive integer between 1 and 100.

Is Quartz scheduler distributed?

Quartz is distributed as a small java library (. jar file) that contains all of the core Quartz functionality. The main interface (API) to this functionality is the Scheduler interface. It provides simple operations such as scheduling/unscheduling jobs, starting/stopping/pausing the scheduler.


1 Answers

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.

like image 96
user1199680 Avatar answered Oct 05 '22 18:10

user1199680