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.
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!
The situation when Quartz was incapable of firing given trigger is called misfire.
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");
}
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With