Too frequent load of Quartz Scheduler in a Spring application

a 夏天 提交于 2019-12-10 23:57:06

问题


I am writing a Spring application and I use Quart Scheduler.

I'm running Jetty server and everything is ok, my app works:

I am sending an HTTP request to the one of my services and then, everything is refreshing:

and Quartz gives this log 3 times:

Here is a piece of my config.xml file:

<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">

    <property name="jobDetail" ref="fileimport" />
    <property name="repeatInterval" value="${prop.checkinterval}" />

</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="jobDetails">
        <list>
            <ref bean="fileimport" />
        </list>
    </property>

    <property name="triggers">
        <list>
            <ref bean="simpleTrigger" />
            </list>
    </property>
</bean>

How can I load context once, during startup, and use it later without refreshing?


回答1:


Your problem here is that the context is reload each time when you load your XML file. Try to create different XML files for each Java Class and then, load each of them just once.

You can use it us a private static field of your class.



来源:https://stackoverflow.com/questions/22296663/too-frequent-load-of-quartz-scheduler-in-a-spring-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!