What I'm really trying to do is create a Quartz job that does not start at the same time, but can also access the JobExecutionContext to get the previousFireTime . Here is my goal:
And this is how I configured my bean:
<bean name="utilityBean" class="UtilityObject" /> <bean id="utilityJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetOjbect" ref="utilityBean" /> <property name="targetMethod" value="execute" /> <property name="concurrent" value="false" /> </bean> <bean name="utilityTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail" ref="utilityJob" /> <property name="startDelay" value="5000" /> <property name="repeatInterval" value="20000" /> </bean>
When I try to run this, it fails while creating the bean with
NoSuchMethodException: UtilityJob.execute ()
Any ideas?
Decision
After reading the answer of the scaffman, I was able to make my decision work. Using the trigger that I had, I knew that it was the name, and found out that the default group is "DEFAULT". I had a class extending the QuartzJobBean class and then this bit of code added:
protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException { boolean isRunning = (ctx.getScheduler().getTriggerState("utilityTrigger", "DEFAULT") == Trigger.STATE_BLOCKED); if (isRunning) {
Sorry for the weird formatting; these are a few long lines!
source share