I just wanted to post a problem and a solution to a problem / misconfiguration-related issue with the TaskExecutorRepeatTemplate, or actually the underlying ThreadPoolTaskExecutor.

If the TaskExecutorRepeatTemplate is mis-configured then Thread Pool threads will hang up the execution (i.e. never finish, waiting for more data to be processed).

This can be solved by adding a destroy-method="shutdown" to the ThreadPoolTaskExecutor bean configuration. But also take into account that Spring will NOT AUTOMATICALLY DESTROY THE BEAN unless you explicitly call the destroy() method of the DisposableBean (i.e. a ClassPathXmlApplicationContext) in your main method.

Another 'gotcha' is that the destroy-method will ONLY be called if the bean is a top-level bean. If it is a nested bean, then Spring (core) does not call it's shutdown method (don't know if this is a Spring bug or not).

Hope this Helps
Regards
AB.