What is the quartz default thread count

我的梦境 提交于 2019-12-05 08:27:10

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...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!