I have created file quartz.properties
and put it in classpath.
The properties are
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 1
But when I start the application I get this message
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
Does it load property or no? I run only one thread for scheduler anyway...
@NikNik
org.quartz.threadPool.threadCount
datatype must be String so It Should be
p.put("org.quartz.threadPool.threadCount", "2");
...
StdSchedulerFactory factory = new StdSchedulerFactory(p);
With Spring Boot 2.1.4 I was able to set the thread pool size with the following property:
spring.quartz.properties.org.quartz.threadPool.threadCount=2
As I am using spring
I did like this.
I created in my common properties
file a property
quartz.threadPool.threadCount=1
And then set the field quartzProperties
of ScheduleFactoryBean
in my xml
<property name="quartzProperties">
<util:properties>
<prop key="org.quartz.threadPool.threadCount">
${quartz.threadPool.threadCount}
</prop>
</util:properties>
</property>
If You are using Annotated Spring Configuration:
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
Properties quartzProperties = new Properties();
quartzProperties.put("org.quartz.threadPool.threadCount", "1");
scheduler.setQuartzProperties(quartzProperties);
...
return scheduler;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With