-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Axel Fontaine opened SPR-6901 and commented
Using the regular task:scheduler element in conjunction with the task:scheduled-tasks element, results, at least with Tomcat, in a server that is unable to shut down.
The server hangs after having logged the following statement:
Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d81cda: defining beans []; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1d49247
Manually defining a task scheduler and setting the threads to run as daemon provides a workaround:
<task:scheduled-tasks scheduler="taskScheduler">
<task:scheduled ref="myTask" method="run" cron="0 0 0 * * ?"/>
</task:scheduled-tasks>
<bean id="taskScheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
<property name="daemon" value="true"/>
</bean>
However this is only a workaround, and the default behavior should work out of the box. As you can see from the forum post reference, I am not the only one facing this issue.
Affects: 3.0.1
Reference URL: http://forum.springsource.org/showthread.php?t=83687
Issue Links:
- TaskExecutor created with task:executor not shutdown when context closes [SPR-6955] #11620 TaskExecutor created with task:executor not shutdown when context closes ("duplicates")
- TaskExecutor created with task:executor not shutdown when context closes [SPR-6955] #11620 TaskExecutor created with task:executor not shutdown when context closes
- Tomcat does not shutdown correctly when using @Scheduled [SPR-7231] #11890 Tomcat does not shutdown correctly when using
@Scheduled