activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r695754 - /activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
Date Tue, 16 Sep 2008 07:38:15 GMT
Author: gnodet
Date: Tue Sep 16 00:38:14 2008
New Revision: 695754

URL: http://svn.apache.org/viewvc?rev=695754&view=rev
Log:
AMQ-1938: The pooled connection factory FactoryBean does not implement DisposableBean, thus
leaking connections

Modified:
    activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java

Modified: activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java?rev=695754&r1=695753&r2=695754&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
(original)
+++ activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
Tue Sep 16 00:38:14 2008
@@ -24,6 +24,7 @@
 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 @@
  * 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 @@
             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;
+        }
+    }
 }



Mime
View raw message