我有cron工作,我想为这份工作添加一些条件。
我的意思是在运行石英之前检查这个条件,如果它是真的然后执行作业,如果它没有跳过这个工作。有没有办法做到这一点?
这是我的调度程序;
<bean id="SystemServicePingExecutorJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="systemService" />
<property name="targetMethod" value="executeSystemNodePing" />
</bean>
<bean id="SystemServiceLeaderExecutorJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="systemService" />
<property name="targetMethod" value="executeLeaderResolution" />
</bean>
<bean id="systemServicePingCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="SystemServicePingExecutorJob" />
<property name="cronExpression" value="0 0/15 * * * ?" />
</bean>
<bean id="systemServiceLeaderCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="SystemServiceLeaderExecutorJob" />
<property name="cronExpression" value="0 0/30 * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="overwriteExistingJobs" value="true"/>
<property name="autoStartup" value="true" />
<property name="quartzProperties">
<props>
<prop key="org.quartz.scheduler.instanceName">MyScheduler</prop>
<prop key="org.quartz.scheduler.instanceId">AUTO</prop>
<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
<prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
<prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
<prop key="org.quartz.threadPool.threadCount">5</prop>
</props>
</property>
<property name="jobDetails">
<list>
<ref bean="SystemServicePingExecutorJob" />
<ref bean="SystemServiceLeaderExecutorJob" />
</list>
</property>
<property name="triggers">
<list>
<ref bean="systemServicePingCronTrigger" />
<ref bean="systemServiceLeaderCronTrigger" />
</list>
</property>
</bean>