簡體   English   中英

春季:配置Quartz Scheduler Factory

[英]Spring: Configuring Quartz Scheduler Factory

嘗試將一些舊的實現遷移到我的項目中。 如何在applicationContext.xml中配置舊的實現? 從舊的代碼庫中,我得到以下信息:

SchedulerFactory類

@Singleton
public class SchedulerFactoryOld {
  private Scheduler scheduler=null;
  private static SchedulerFactory factory = new StdSchedulerFactory();

  @Produces
  public Scheduler getScheduler() {

        synchronized (factory) {
            if(scheduler != null)
                return scheduler;

            try {
                scheduler = factory.getScheduler();
            } catch (SchedulerException e) {

            }

            return scheduler;
        }
    }
}

quartz.properties

org.quartz.scheduler.instanceName = QuartzScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 8
org.quartz.threadPool.threadPriority = 8
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

這是啟動和運行它的基本xml方法。 您的配置選項可能有所不同,但您可以根據屬性引用它

<bean id="scheduler"
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
            <ref bean="yourTrigger" />
        </list>
    </property>
    <property name="schedulerContextAsMap">
        <map>
            <entry key="someManagerOrBusinessCode" value-ref="someManagerOrBusinessCode" />
        </map>
    </property>
    <property name="configLocation" value="${quartz.config.location}" />
    <property name="overwriteExistingJobs" value="true" />
</bean>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM