mirror of https://github.com/apache/activemq.git
AMQ-1938: The pooled connection factory FactoryBean does not implement DisposableBean, thus leaking connections
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@695754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
398b468b68
commit
1590da28a5
|
@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.commons.pool.ObjectPoolFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
|
||||
/**
|
||||
* Simple factory bean used to create a jencks connection pool.
|
||||
|
@ -43,11 +44,11 @@ import org.springframework.beans.factory.InitializingBean;
|
|||
* maps correctly the connection factory to the recovery process.
|
||||
*
|
||||
*/
|
||||
public class PooledConnectionFactoryBean implements FactoryBean, InitializingBean {
|
||||
public class PooledConnectionFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(PooledConnectionFactoryBean.class);
|
||||
|
||||
private ConnectionFactory pooledConnectionFactory;
|
||||
private PooledConnectionFactory pooledConnectionFactory;
|
||||
private ConnectionFactory connectionFactory;
|
||||
private int maxConnections = 1;
|
||||
private int maximumActive = 500;
|
||||
|
@ -162,4 +163,11 @@ public class PooledConnectionFactoryBean implements FactoryBean, InitializingBea
|
|||
throw new IllegalStateException("Unable to create pooled connection factory. Enable DEBUG log level for more informations");
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() throws Exception {
|
||||
if (pooledConnectionFactory != null) {
|
||||
pooledConnectionFactory.stop();
|
||||
pooledConnectionFactory = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue