I have cron jobs and I want to add some condition to this jobs.
I mean before running quartz check this condition and if its true then execute job, if its not skip the job. Is there any way to do this?
Here is my schedulers;
<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>