Search code examples
javathreadpoolquartz-scheduler

How to make sure quartz.properties is being used?


I set following properties in my quartz.properties file:

org.quartz.threadPool.threadCount = 60
org.quartz.scheduler.batchTriggerAcquisitionMaxCount = 60

, however, for some reason, apparently it doesn't take effect. because when I start my application, the log shows that it still uses 1 thread in the pool:

[main] INFO org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor 
[main] INFO org.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 
[main] INFO org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.1.1 created. 
[main] INFO org.quartz.simpl.RAMJobStore - RAMJobStore initialized.
[main] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.1.1) '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 1 threads.**

I know, the quartz.properties needs to be at class path to be found. and I just did it. any other reason why this file is not detected? or it is detected but number of threads is not set correctly?

Thanks


Solution

  • oops, I found the problem, actually the code was overriding the properties file config by creating an instance of Properties class in the code. so the answer is this line:

    sf = new StdSchedulerFactory("conf/quartz.properties");