Browse Source

RESOLVED - issue SPR-6955, SPR-6901 added DisposableBean to TaskExecutorFactoryBean

pull/23217/head
David Syer 15 years ago
parent
commit
8d7df01d73
  1. 9
      org.springframework.context/src/main/java/org/springframework/scheduling/config/TaskExecutorFactoryBean.java

9
org.springframework.context/src/main/java/org/springframework/scheduling/config/TaskExecutorFactoryBean.java

@ -20,6 +20,7 @@ import org.springframework.beans.BeanWrapper; @@ -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; @@ -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 @@ -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…
Cancel
Save