Quartz trigger state is not persisting on server start

微笑、不失礼 提交于 2019-12-12 02:51:28

问题


We have a requirement to pause a job before application maintenance. We are using Quartz 2.2.1 in cluster. Database is oracle.

I have developed a screen with "Pause" functionality. I observed that "pause" works fine until I start the server again. The moment I start server, TRIGGER_STATE of QRTZ_TRIGGERS table resets to "WAITING".

Can anyone please provide a hint.

Thanks a lot in advance.

Rgds - Roy


回答1:


If you have set overwriteExistingJobs=true (note that default value is false) then each time server starts, it loads the jobs/triggers from the configuration file and replaces existing ones (that have the same job/trigger names), therefore overwriting triggers and their states too as in your case.

You could try to set overwriteExistingJobs=false in the SchedulerFactoryBean. This however may not be convenient for you, since if you ever change job configuration in the server, the existing jobs with old configuration will remain in the database.

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    ....
    <property name="overwriteExistingJobs" value="false"/>
    <property name="triggers">
        <list>
            ....
        </list>
    </property>
    ....
</bean>


来源:https://stackoverflow.com/questions/26586089/quartz-trigger-state-is-not-persisting-on-server-start

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