Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the quartz default thread count

I am new to Quartz. I did manage to figure out that default value for Scheduler configuration is org.quartz.threadPool.threadCount=-1.

But it did not find anywhere what this implies. Does this mean that there will be only one thread or has it some other 'number'?

I am playing with quartz-scheduler v2.2.

like image 831
Jef Avatar asked Mar 01 '16 13:03

Jef


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!

What is misfire in quartz?

The situation when Quartz was incapable of firing given trigger is called misfire.


2 Answers

It depends..

If you use Spring Framework then you can see that the real default is defined in SchedulerFactoryBean:

public static final int DEFAULT_THREAD_COUNT = 10;

In case of using bare Quartz and and not passing any property, it will use its default configuration, which you can find it in org.quartz.properties:quartz jar. It's called quartz.properties (here's link) and contains:

# Default Properties file for use by StdSchedulerFactory
# to create a Quartz Scheduler Instance, if a different
# properties file is not explicitly specified.
#

org.quartz.scheduler.instanceName: DefaultQuartzScheduler
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false

org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 10
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true

org.quartz.jobStore.misfireThreshold: 60000

org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore

So, it's 10 in the most cases.

On the other hand, if you just wanted to create SimpleThreadPool without specyfying thread-pool size, it will throw exception from initialize method as (here's link):

if (count <= 0) {
    throw new SchedulerConfigException(
            "Thread count must be > 0");
}
like image 167
Maciej Dobrowolski Avatar answered Oct 06 '22 00:10

Maciej Dobrowolski


Try to start Quartz with default value org.quartz.threadPool.threadCount=-1

It doesn't start. You got org.quartz.SchedulerConfigException: Thread count must be > 0

The default -1 value force you to config org.quartz.threadPool.threadCount to your value more then 0 .

From jdoc

org.quartz.threadPool.threadCount

Can be any positive integer...

like image 41
Eugene Kirin Avatar answered Oct 05 '22 22:10

Eugene Kirin