activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1406657 - in /activemq/trunk/activemq-pool/src: main/java/org/apache/activemq/pool/PooledConnectionFactory.java main/java/org/apache/activemq/pool/XaPooledConnectionFactory.java test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
Date Wed, 07 Nov 2012 14:34:48 GMT
Author: tabish
Date: Wed Nov  7 14:34:47 2012
New Revision: 1406657

URL: http://svn.apache.org/viewvc?rev=1406657&view=rev
Log:
fix issue introduced in https://issues.apache.org/jira/browse/AMQ-4019 for XA connections.

Modified:
    activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
    activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/XaPooledConnectionFactory.java
    activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java

Modified: activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java?rev=1406657&r1=1406656&r2=1406657&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
(original)
+++ activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
Wed Nov  7 14:34:47 2012
@@ -130,7 +130,7 @@ public class PooledConnectionFactory imp
                 public ConnectionPool makeObject(ConnectionKey key) throws Exception {
                     ActiveMQConnection delegate = createConnection(key);
 
-                    ConnectionPool connection = new ConnectionPool(delegate);
+                    ConnectionPool connection = createConnectionPool(delegate);
                     connection.setIdleTimeout(getIdleTimeout());
                     connection.setExpiryTimeout(getExpiryTimeout());
                     connection.setMaximumActiveSessionPerConnection(getMaximumActiveSessionPerConnection());
@@ -484,4 +484,16 @@ public class PooledConnectionFactory imp
      */
     public void setPoolFactory(ObjectPoolFactory<?> factory) {
     }
+
+    /**
+     * Delegate that creates each instance of an ConnectionPool object.  Subclasses can override
+     * this method to customize the type of connection pool returned.
+     *
+     * @param connection
+     *
+     * @return instance of a new ConnectionPool.
+     */
+    protected ConnectionPool createConnectionPool(ActiveMQConnection connection) {
+        return new ConnectionPool(connection);
+    }
 }

Modified: activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/XaPooledConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/XaPooledConnectionFactory.java?rev=1406657&r1=1406656&r2=1406657&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/XaPooledConnectionFactory.java
(original)
+++ activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/XaPooledConnectionFactory.java
Wed Nov  7 14:34:47 2012
@@ -49,6 +49,7 @@ public class XaPooledConnectionFactory e
         this.transactionManager = transactionManager;
     }
 
+    @Override
     protected ConnectionPool createConnectionPool(ActiveMQConnection connection) {
         return new XaConnectionPool(connection, getTransactionManager());
     }

Modified: activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java?rev=1406657&r1=1406656&r2=1406657&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
(original)
+++ activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
Wed Nov  7 14:34:47 2012
@@ -33,6 +33,7 @@ import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;
 import org.apache.activemq.ActiveMQXAConnectionFactory;
+import org.apache.activemq.ActiveMQXASession;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.test.TestSupport;
 
@@ -122,6 +123,11 @@ public class XAConnectionPoolTest extend
 
         TopicConnection connection = (TopicConnection) pcf.createConnection();
         TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        assertTrue(session instanceof PooledSession);
+        PooledSession pooledSession = (PooledSession) session;
+        assertTrue(pooledSession.getInternalSession() instanceof ActiveMQXASession);
+
         TopicPublisher publisher = session.createPublisher(topic);
         publisher.publish(session.createMessage());
 



Mime
View raw message