-
Jan 19th, 2006, 07:00 PM
#1
old quartz thread keeps running after war redeploy
Hi,
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?
Thanks
-
Jan 20th, 2006, 03:42 AM
#2
Can you not add a shutdown hook to do it?
Bob
-
Jan 20th, 2006, 03:42 AM
#3
Have you tried to wait for the jobs to complete before shutdown?
The SchedulerFactoryBean has a method for this
setWaitForJobsToCompleteOnShutdown()
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.
/Claus
-
Jan 20th, 2006, 12:56 PM
#4
Hi,
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="scoringInvoker"
class="com.mybatch.ScoringInvoker">
</bean>
<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>
<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>
<bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
<property name="triggers">
<list>
<ref bean="scoringInvokerSimpleTrigger"/>
</list>
</property>
</bean>
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.
Mrtz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules