Regarding quartz periodicity, there are no periodic issues in the configuration file when starting service

Keywords: Java

Regarding quartz periodicity, there are no periodic issues in the configuration file when starting service

Cause of the problem: Service in production environment, configuration file information not loaded, and quartz connection timeout

Finding the reason found that because someone else created a periodic file and named the id of the quartz factory class the same as the id of the previous file, another configuration file could not be loaded because of the singleton.

Correct configuration: Multiple periodic configurations can be made to the same file with the same quartz factory class or with different id names for quartz factory class

    <bean id="xxxjob"
        class="org.springframework.scheduling.quartz.JobDetailBean"> 
           <!--Class of invocation -->
        <property name="jobClass" value="com.cvicse.hrzcyp.flow.InfoSubmitProjectMessageTimingFlow">
        </property> 
        <property name="jobDataAsMap">
            <map>
                <entry key="timeout" value="0"/>
            </map>
        </property>
    </bean> 
    <!-- Timing task-Presentation of collateral information  -->
    <bean id="xxx" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="xxxjob" />
        </property> 
           <!--  cron Expression -->
        <property name="cronExpression" >
            <!-- 23 per day:00:00 implement -->
            <value>0 0 23 * * ? *</value>
        </property>
    </bean> 

    <!-- quartz Factory class -->
    <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="configLocation" value="classpath:quartz.properties" />
        <property name="dataSource" ref="dataSource"></property>
        <property name="quartzProperties">
            <map>
                <entry key="org.quartz.jobStore.isClustered" value="true" />
                <entry key="org.quartz.scheduler.instanceName" value="MyClusteredScheduler" />
                <entry key="org.quartz.scheduler.instanceId" value="AUTO" />
                <entry key="org.quartz.plugin.jobHistory.class" value="org.quartz.plugins.history.LoggingJobHistoryPlugin" />
            </map>
        </property>
        <property name="triggers">
            <list>
                <ref bean= "xxx" />
            </list>
        </property>
    </bean> 

Posted by monkeyj on Mon, 30 Sep 2019 17:50:32 -0700