RESOLVED - issue SPR-6955, SPR-6901 added DisposableBean to TaskExecutorFactoryBean
This commit is contained in:
parent
5303ab68aa
commit
8d7df01d73
|
|
@ -20,6 +20,7 @@ import org.springframework.beans.BeanWrapper;
|
|||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.JdkVersion;
|
||||
|
|
@ -33,7 +34,7 @@ import org.springframework.util.StringUtils;
|
|||
* @author Mark Fisher
|
||||
* @since 3.0
|
||||
*/
|
||||
public class TaskExecutorFactoryBean implements FactoryBean<TaskExecutor>, BeanNameAware {
|
||||
public class TaskExecutorFactoryBean implements FactoryBean<TaskExecutor>, BeanNameAware, DisposableBean {
|
||||
|
||||
private volatile TaskExecutor target;
|
||||
|
||||
|
|
@ -90,6 +91,12 @@ public class TaskExecutorFactoryBean implements FactoryBean<TaskExecutor>, BeanN
|
|||
return true;
|
||||
}
|
||||
|
||||
public void destroy() throws Exception {
|
||||
if (this.target instanceof DisposableBean) {
|
||||
((DisposableBean) this.target).destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeExecutor() throws Exception {
|
||||
synchronized (this.initializationMonitor) {
|
||||
if (this.target != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue