Hi,
I have a stand-alone spring application, and I am trying to test the behaviour of graceful shutdown by using registerShutdownHook feature. I see that the application waits for all current processes to complete once i shutdown the application. The only exception is a poller thread and it dies halfway although the @Predestroy method is being invoked in that class.
I have the following definition in beans.xml
In the above fragemetn myPoller simply implements Runnable interface. I have put a short sleep in the run method and placed a log statement before and after the sleep. While it is sleeping I have the killed the process, it never resumes the statement after the sleep statement.Code:<bean id="scheduledTasks" class="org.springframework.scheduling.timer.TimerTaskExecutor"> <property name="timer"> <bean class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <bean class="org.springframework.scheduling.timer.ScheduledTimerTask" p:runnable-ref="myPoller" /> </list> </property> </bean> </property> </bean>
Ideally, I was hoping the application will not shutdown until the thread completes it business.
Thanks.


Reply With Quote