Quartz配置ThreadPool设置-003

23 篇文章 0 订阅

配置ThreadPool设置

Property NameRequiredTypeDefault Value
org.quartz.threadPool.classyes

string (class name)

null
org.quartz.threadPool.threadCountyesint-1
org.quartz.threadPool.threadPrioritynointThread.NORM_PRIORITY (5)

org.quartz.threadPool.class

是要使用的ThreadPool实现的名称。Quartz附带的线程池是“org.quartz.simpl.SimpleThreadPool”,并且应该能够满足几乎每个用户的需求。它有非常简单的行为,并经过很好的测试。它提供了一个固定大小的线程池,可以“生活”计划程序的生命周期。

org.quartz.threadPool.threadCount

可以是任何正整数,虽然你应该意识到只有1到100之间的数字是非常实用的。这是可用于并发执行作业的线程数。如果你只有几个工作每天发射几次,那么1个线程是很多!如果你有成千上万的工作,每分钟都有很多工作,那么你可能希望一个线程数可能更多的是50或100(这很重要,取决于你的工作所执行的工作的性质,以及你的系统资源!)。

org.quartz.threadPool.threadPriority

可以是Thread.MIN_PRIORITY(即1)和Thread.MAX_PRIORITY(这是10)之间的任何int 。默认值为Thread.NORM_PRIORITY(5)。

 

SimpleThreadPool特定的属性

Property NameRequiredTypeDefault Value
org.quartz.threadPool.makeThreadsDaemonsnobooleanfalse
org.quartz.threadPool.threadsInheritGroupOfInitializingThreadnobooleantrue
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThreadnobooleanfalse
org.quartz.threadPool.threadNamePrefixnostring[Scheduler Name]_Worker

org.quartz.threadPool.makeThreadsDaemons

可以设置为“true”,使池中的线程创建为守护进程线程。默认为“false”。另请参见org.quartz.scheduler.makeSchedulerThreadDaemon属性。

org.quartz.threadPool.threadsInheritGroupOfInitializingThread

可以是“true”或“false”,默认为true。

org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread

可以是“true”或“false”,默认为false。

org.quartz.threadPool.threadNamePrefix

在工作池中的线程名称的前缀将被附加一个数字。

自定义ThreadPools

如果你使用你自己的一个线程池的实现,你可以通过命名属性来简单地设置它上面的属性:

在自定义线程池上设置属性

org.quartz.threadPool.class = com.mycompany.goo.FooThreadPool
org.quartz.threadPool.somePropOfFooThreadPool = someValue

转自:https://www.w3cschool.cn/quartz_doc/quartz_doc-7vix2d9n.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值