我在 Spring 应用程序中有一些计划任务,它们的配置如下:
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- Here the list of tasks -->
</list>
</property>
</bean>
我遇到了一些问题(有些任务没有在它们应该运行的时候运行,但并不总是在很长一段时间后或在特定时间运行)我认为这可能是因为有很多任务(到目前为止有 11 个)和系统不能同时运行它们。我想过像这样设置 org.quartz.threadPool.threadCount
来增加并行线程的数量:
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- Here the list of tasks -->
</list>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.threadPool.threadCount">15</prop>
</props>
</property>
</bean>
但我想知道,当我没有设置 org.quartz.threadPool.threadCount
属性时,系统使用了多少线程?默认行为是什么?
最佳答案
当谷歌搜索“SchedulerFactoryBean.java”第一个链接(SchedulerFactoryBean.java)时,我打开了源代码:
public static final int DEFAULT_THREAD_COUNT = 10;
此值稍后用于在 initSchedulerFactory 方法中设置 org.quartz.threadPool.threadCount:
mergedProps.setProperty(PROP_THREAD_COUNT, Integer.toString(DEFAULT_THREAD_COUNT));
关于java - 未指定时使用的默认 "org.quartz.threadPool.threadCount"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14979917/