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
Configuration of Quartz is typically done through the use of a properties file, in conjunction with the use of StdSchedulerFactory (which consumes the configuration file and instantiates a scheduler). By default, StdSchedulerFactory load a properties file named “quartz. properties” from the 'current working directory'.
You can configure Quartz in the quartz. properties configuration file located in the EXPRESSO_HOME/config directory. For additional information, refer to the Quartz documentation available at: http://quartz-scheduler.org/documentation/quartz-2.x/configuration/.
servlet. QuartzInitializerListener to fire up a scheduler in your servlet container, its contextDestroyed() method will shutdown the scheduler when your application is undeployed or the application server shuts down (unless its shutdown-on-unload property has been explicitly set to false).
The Quartz package includes a number of jar files, located in root directory of the distribution. The main Quartz library is named quartz-xxx. jar (where xxx is a version number).
For those who are using Spring + Quartz and quartz.properties
file is not working (i.e. gets ignored while starting the application):
Quartz Scheduler (org.quartz.Scheduler
) instantiated by Spring Factory Bean (org.springframework.scheduling.quartz.SchedulerFactoryBean
) won't read quartz.properties
file from the classpath by default as it's said in Quartz docs - you need to set the reference manually:
[in case of Java config]:
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
schedulerFactoryBean.setConfigLocation(new ClassPathResource("quartz.properties"));
// ...
}
[in case of XML config]:
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="configLocation" value="classpath:quartz.properties" />
// ...
</bean>
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