1

Trying to migrate some old implementation to my project. How can I configure the old implementation in applicationContext.xml? From the old code base I have got following:

SchedulerFactory class

@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
1

1 Answer 1

1

here is a basic xml way to get it up and going. your config options might be different but you can reference it based on a property

<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>

Not the answer you're looking for? Browse other questions tagged or ask your own question.