Affects Version/s: 2.0.0, 1.3.1
Fix Version/s: None
Affects 1.3.1 and 2.0.0.M1.
SimpleJobService is implementing DisposableBean interface, providing a destroy method, which tries to stop any active job executions in case of a context shutdown. This is a very useful feature, otherwise those active running job executions will be killed and remain as STARTED-zombies in the job repository.
Unfortunately, the destroy() method is never called in case of context shutdown:
- META-INF/spring/batch/bootstrap/manager/execution-context.xml is defining 'jobService' via SimpleJobServiceFactoryBean, so in case of context shutdown only the destroy() method of the factory bean would be called, and not for the bean instance(s) created by the factory bean.
- This leads to second issue: Currently SimpleJobServiceFactoryBean does not implement interface 'DisposableBean' and therefore has no destroy() method...
In case of shutdown and configuration using SimpleJobServiceFactoryBean
- destroy() method of SimpleJobServiceFactoryBean should be called.
- destroy() method of (singleton) instance SimpleJobService - as provided by factory bean - should be called.
1) As isSingleton() always returns "true" for the factory bean, change signature of factory bean class from
as AbstractFactoryBean already provides all the required code for singleton-handling and proper destroy() handling.
2) add interface 'DispoableBean' to signature of SimpleJobServiceFactoryBean and add "missing" code (destroy() method, singleton caching).