我是Quartz的新手。我确实设法弄清楚了调度程序配置的默认值是org.quartz.threadPool.threadCount=-1。
但它在任何地方都没有找到这意味着什么。这是不是意味着只有一个线程,或者它有其他的“编号”?
我正在使用quartz-scheduler v2.2。
发布于 2016-03-01 22:09:31
这要看情况。
如果使用Spring Framework,则可以看到真正的默认值是在SchedulerFactoryBean中定义的
public static final int DEFAULT_THREAD_COUNT = 10;在使用裸Quartz并且不传递任何属性的情况下,它将使用其默认配置,您可以在org.quartz.properties:quartz jar中找到它。它名为quartz.properties (here's link),包含:
# 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因此,在大多数情况下,它是10。
另一方面,如果你只是想在不指定线程池大小的情况下创建SimpleThreadPool,它将抛出来自initialize方法的异常,如(here's link):
if (count <= 0) {
throw new SchedulerConfigException(
"Thread count must be > 0");
}发布于 2016-03-01 22:43:24
尝试使用默认值org.quartz.threadPool.threadCount=-1启动Quartz
启动不了。你得到了org.quartz.SchedulerConfigException: Thread count must be > 0
默认的-1值强制您将org.quartz.threadPool.threadCount配置为大于0的值。
来自jdoc
org.quartz.threadPool.threadCount
可以是任何正整数...
https://stackoverflow.com/questions/35723948
复制相似问题