2017-04-20 47 views
0

我創建了文件quartz.properties,並將它放在classpath中。 屬性是設置石英線程池的線程數

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool 
org.quartz.threadPool.threadCount = 1 

但是當我啓動應用程序,我得到這個消息

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. 

是否加載財產或沒有?無論如何,我只爲調度程序運行一個線程...

回答

0

:但是,aviod使用特性,您可以使用Java配置配置調度。 我在通用properties文件中創建一個屬性

quartz.threadPool.threadCount=1 

然後在我的XML

<property name="quartzProperties"> 
    <util:properties> 
     <prop key="org.quartz.threadPool.threadCount"> 
      ${quartz.threadPool.threadCount} 
     </prop> 
    </util:properties> 
</property> 
0

它可能沒有加載你的屬性文件。由於我使用spring我不喜歡這個

Properties p = new Properties(); 
p.put("org.quartz.scheduler.instanceName", "Scheduler_test"); 
p.put("org.quartz.threadPool.threadCount", 2); 
... 
StdSchedulerFactory factory = new StdSchedulerFactory(p); 
+0

燁。確實。儘管我使用了「屬性」文件 – lapots

0

如果您正在使用帶註釋的Spring配置文件設定的ScheduleFactoryBean領域quartzProperties

@Bean 
public SchedulerFactoryBean schedulerFactoryBean() {   
    SchedulerFactoryBean scheduler = new SchedulerFactoryBean(); 
    Properties quartzProperties = new Properties();  
    quartzProperties.put("org.quartz.threadPool.threadCount", "1"); 
    scheduler.setQuartzProperties(quartzProperties); 
    ... 
    return scheduler; 
}