什么是quartz默认线程数 [英] What is the quartz default thread count

查看:373
本文介绍了什么是quartz默认线程数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Quartz 的新手.我确实设法找出调度程序配置的默认值是 org.quartz.threadPool.threadCount=-1.

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'?

我在玩quartz-scheduler v2.2.

I am playing with quartz-scheduler v2.2.

推荐答案

这取决于..

如果你使用 Spring Framework 那么你可以看到真正的默认定义在 SchedulerFactoryBean:

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;

如果使用裸 Quartz 并且不传递任何属性,它将使用其默认配置,您可以在 org.quartz.properties:quartz 中找到它罐.它被称为 quartz.properties (这里是链接) 并包含:

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

因此,在大多数情况下是 10.

So, it's 10 in the most cases.

另一方面,如果你只是想创建 SimpleThreadPool 而不指定线程池大小,它会从 initialize 方法抛出异常为 (这里是链接):

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");
}

这篇关于什么是quartz默认线程数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆