spring-boot - Spring quartz thread pool count is not changed - TagMerge
1Spring quartz thread pool count is not changedSpring quartz thread pool count is not changed

Spring quartz thread pool count is not changed

Asked 7 months ago
0
1 answers

I tested your configuration on spring-boot 2.6.0 and it works fine as can be seen below. By default the thread pool size is 10 if you use spring-boot-starter-quartz without any additional configuration and it looks like the configuration is not getting picked so please check if your properties file name is correct ( in the question you have named it application.properies )

application.properties

spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=never
spring.quartz.overwrite-existing-jobs=true
spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
spring.quartz.properties.org.quartz.threadPool.threadCount=20

Here is the logs output

2021-12-29 20:23:10.231  INFO 36936 --- [           main] org.quartz.core.QuartzScheduler          : Scheduler meta-data: Quartz Scheduler (v2.3.2) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
  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 20 threads.
  Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is not clustered.

Update

The actual configuration work happens in the QuartzAutoConfiguration class where the properties read by Spring are injected. You can verify what properties are being read for quartz and injected by putting a breakpoint in a debugger ( I am using Eclipse). As can be seen - there are 2 properties one of which is related to thread count which has been read as 20 and is available for being injected into Quartz configuration.

enter image description here

Source: link

Recent Questions on spring-boot

    Programming Languages