Jan 19th, 2006, 07:00 PM
old quartz thread keeps running after war redeploy
I have configured a SchedulerFactoryBean with a single trigger with SimpleTriggerBean scheduled to run every 60 seconds. This is with Spring+Quartz on JBoss.
Problem is that when the application war file is redeployed on the running JBoss server, the old Quartz thread seems to keep running and a new one is also created.
How does one force the old Quartz thread to completely shutdown when the app server redeploys the war?
Jan 20th, 2006, 03:42 AM
Can you not add a shutdown hook to do it?
Jan 20th, 2006, 03:42 AM
Have you tried to wait for the jobs to complete before shutdown?
The SchedulerFactoryBean has a method for this
When the war is reloaded you should see spring log at info level
"Shutting down Quartz scheduler"
This would call the shutdown on Quartz that should terminate the running threads.
Jan 20th, 2006, 12:56 PM
I have two questions about how I should do this right:
1. Sounds like a good idea to wait for the job to finish before shutting down the scheduler. Though I'm not sure how I should set setWaitForJobsToCompleteOnShutdown() to true. Can that be set to true via a property setting in the Spring configuration for the SchedulerFactoryBean bean, and if so what is the property and syntax for setting that to true? (From the method name, I guess the property should be <property name="waitForJobsToCompleteOnShutdown" value="true"/>)
Here is my config:
<bean id="scoringInvokerJobDetail" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
<property name="targetObject" ref="scoringInvoker"/>
<property name="targetMethod" value="invoke"/>
<property name="concurrent" value="false"/>
<bean id="scoringInvokerSimpleTrigger" class="org.springframework.scheduling.quartz.Simpl eTriggerBean">
<property name="jobDetail" ref="scoringInvokerJobDetail"/>
<!-- 10 seconds delay after scheduler startup -->
<property name="startDelay" value="10000"/>
<!-- repeat job every 60 seconds -->
<property name="repeatInterval" value="60000"/>
<bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
2. In addition to waiting for the job to finish, I would like to be able to "notify" the job (in this case the "com.mybatch.ScoringInvoker" class) that it is time to stop processing. Is there a way to configure this in the bean for ScoringInvoker something like <property name="notifyMethod" value="stop"/>. Or is there some other way to do it?
Thanks for your help.