You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/06/13 18:35:29 UTC

[1/4] git commit: https://issues.apache.org/jira/browse/AMQ-5224

Repository: activemq
Updated Branches:
  refs/heads/trunk 878e3a16c -> 7ceb4d0c8


https://issues.apache.org/jira/browse/AMQ-5224

Fix some JavaDocs 

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/9ae22642
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/9ae22642
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/9ae22642

Branch: refs/heads/trunk
Commit: 9ae22642dc14ef70563b858a9359ab47c69ebeda
Parents: 878e3a1
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jun 13 11:09:56 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jun 13 11:09:56 2014 -0400

----------------------------------------------------------------------
 .../apache/activemq/jms/pool/PooledConnectionFactory.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/9ae22642/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
index e60c52b..8bc7bcc 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
@@ -161,7 +161,7 @@ public class PooledConnectionFactory implements ConnectionFactory {
      * <p/>
      * Updates to this value do not affect Connections that were previously created and placed
      * into the pool.  In order to allocate new Connections based off this new ConnectionFactory
-     * it is first necessary to {@link clear} the pooled Connections.
+     * it is first necessary to {@link #clear} the pooled Connections.
      *
      * @param toUse
      *      The factory to use to create pooled Connections.
@@ -290,7 +290,7 @@ public class PooledConnectionFactory implements ConnectionFactory {
     /**
      * Clears all connections from the pool.  Each connection that is currently in the pool is
      * closed and removed from the pool.  A new connection will be created on the next call to
-     * {@link createConnection}.  Care should be taken when using this method as Connections that
+     * {@link #createConnection}.  Care should be taken when using this method as Connections that
      * are in use be client's will be closed.
      */
     public void clear() {
@@ -352,7 +352,7 @@ public class PooledConnectionFactory implements ConnectionFactory {
 
     /**
      * Returns the maximum number to pooled Connections that this factory will allow before it
-     * begins to return connections from the pool on calls to ({@link createConnection}.
+     * begins to return connections from the pool on calls to ({@link #createConnection}.
      *
      * @return the maxConnections that will be created for this pool.
      */
@@ -362,7 +362,7 @@ public class PooledConnectionFactory implements ConnectionFactory {
 
     /**
      * Sets the maximum number of pooled Connections (defaults to one).  Each call to
-     * {@link createConnection} will result in a new Connection being create up to the max
+     * {@link #createConnection} will result in a new Connection being create up to the max
      * connections value.
      *
      * @param maxConnections the maxConnections to set


[2/4] git commit: https://issues.apache.org/jira/browse/AMQ-5224

Posted by ta...@apache.org.
https://issues.apache.org/jira/browse/AMQ-5224

Ensure PooledConnectionFactory implements QueueConnectionFactory and
TopicConnectionFactory

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/459593c4
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/459593c4
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/459593c4

Branch: refs/heads/trunk
Commit: 459593c4277637e1a5186d823c04f6afebc21858
Parents: 9ae2264
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jun 13 11:18:24 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jun 13 11:18:24 2014 -0400

----------------------------------------------------------------------
 .../jms/pool/PooledConnectionFactory.java       | 26 ++++++++++++++++++-
 .../jms/pool/XaPooledConnectionFactory.java     | 27 +-------------------
 .../jms/pool/PooledConnectionFactoryTest.java   |  9 +++++++
 3 files changed, 35 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/459593c4/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
index 8bc7bcc..16f2701 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
@@ -22,6 +22,10 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.JMSException;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
 import javax.jms.XAConnectionFactory;
 
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
@@ -58,7 +62,7 @@ import org.slf4j.LoggerFactory;
  * configure the idle eviction thread to run.
  *
  */
-public class PooledConnectionFactory implements ConnectionFactory {
+public class PooledConnectionFactory implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory {
     private static final transient Logger LOG = LoggerFactory.getLogger(PooledConnectionFactory.class);
 
     protected final AtomicBoolean stopped = new AtomicBoolean(false);
@@ -184,6 +188,26 @@ public class PooledConnectionFactory implements ConnectionFactory {
     }
 
     @Override
+    public QueueConnection createQueueConnection() throws JMSException {
+        return (QueueConnection) createConnection();
+    }
+
+    @Override
+    public QueueConnection createQueueConnection(String userName, String password) throws JMSException {
+        return (QueueConnection) createConnection(userName, password);
+    }
+
+    @Override
+    public TopicConnection createTopicConnection() throws JMSException {
+        return (TopicConnection) createConnection();
+    }
+
+    @Override
+    public TopicConnection createTopicConnection(String userName, String password) throws JMSException {
+        return (TopicConnection) createConnection(userName, password);
+    }
+
+    @Override
     public Connection createConnection() throws JMSException {
         return createConnection(null, null);
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/459593c4/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
index 5e44be2..d5fbc60 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
@@ -20,11 +20,6 @@ import java.io.Serializable;
 import java.util.Hashtable;
 
 import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
 import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -40,7 +35,7 @@ import org.slf4j.LoggerFactory;
  * A pooled connection factory that automatically enlists sessions in the
  * current active XA transaction if any.
  */
-public class XaPooledConnectionFactory extends PooledConnectionFactory implements ObjectFactory, Serializable, QueueConnectionFactory, TopicConnectionFactory {
+public class XaPooledConnectionFactory extends PooledConnectionFactory implements ObjectFactory, Serializable {
 
     private static final transient Logger LOG = LoggerFactory.getLogger(XaPooledConnectionFactory.class);
     private static final long serialVersionUID = -6545688026350913005L;
@@ -122,24 +117,4 @@ public class XaPooledConnectionFactory extends PooledConnectionFactory implement
     public void setTmFromJndi(boolean tmFromJndi) {
         this.tmFromJndi = tmFromJndi;
     }
-
-    @Override
-    public QueueConnection createQueueConnection() throws JMSException {
-        return (QueueConnection) createConnection();
-    }
-
-    @Override
-    public QueueConnection createQueueConnection(String userName, String password) throws JMSException {
-        return (QueueConnection) createConnection(userName, password);
-    }
-
-    @Override
-    public TopicConnection createTopicConnection() throws JMSException {
-        return (TopicConnection) createConnection();
-    }
-
-    @Override
-    public TopicConnection createTopicConnection(String userName, String password) throws JMSException {
-        return (TopicConnection) createConnection(userName, password);
-    }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/459593c4/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
index e20a605..289030f 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
@@ -32,7 +32,9 @@ import java.util.concurrent.TimeUnit;
 
 import javax.jms.Connection;
 import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
 import javax.jms.Session;
+import javax.jms.TopicConnectionFactory;
 
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -56,6 +58,13 @@ public class PooledConnectionFactoryTest {
     public final static Logger LOG = Logger.getLogger(PooledConnectionFactoryTest.class);
 
     @Test
+    public void testInstanceOf() throws  Exception {
+        PooledConnectionFactory pcf = new PooledConnectionFactory();
+        assertTrue(pcf instanceof QueueConnectionFactory);
+        assertTrue(pcf instanceof TopicConnectionFactory);
+    }
+
+    @Test
     public void testClearAllConnections() throws Exception {
 
         ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");


[4/4] git commit: https://issues.apache.org/jira/browse/AMQ-5223

Posted by ta...@apache.org.
https://issues.apache.org/jira/browse/AMQ-5223

Added the bundle packaging option

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/7ceb4d0c
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/7ceb4d0c
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/7ceb4d0c

Branch: refs/heads/trunk
Commit: 7ceb4d0c8e55364c21e798918eaf1fdb18b95138
Parents: 577b29c
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jun 13 12:35:13 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jun 13 12:35:13 2014 -0400

----------------------------------------------------------------------
 activemq-jms-pool/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/7ceb4d0c/activemq-jms-pool/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/pom.xml b/activemq-jms-pool/pom.xml
index 94ca075..c448ffa 100755
--- a/activemq-jms-pool/pom.xml
+++ b/activemq-jms-pool/pom.xml
@@ -28,6 +28,7 @@
   <artifactId>activemq-jms-pool</artifactId>
   <name>ActiveMQ :: Generic JMS Pool</name>
   <description>Generic JMS Pooled ConnectionFactory</description>
+  <packaging>bundle</packaging>
 
   <properties>
     <activemq.osgi.import.pkg>


[3/4] git commit: https://issues.apache.org/jira/browse/AMQ-5224

Posted by ta...@apache.org.
https://issues.apache.org/jira/browse/AMQ-5224

Support for XAConnectionFactory that do not implement ConnectionFactory 

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/577b29c0
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/577b29c0
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/577b29c0

Branch: refs/heads/trunk
Commit: 577b29c0e5ef666c5c8112031d7a9d2f3ce94935
Parents: 459593c
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jun 13 12:30:17 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jun 13 12:30:17 2014 -0400

----------------------------------------------------------------------
 .../jms/pool/GenericResourceManager.java        |  7 ++++-
 .../jms/pool/PooledConnectionFactory.java       | 32 ++++++++------------
 .../jms/pool/XaPooledConnectionFactory.java     | 24 +++++++++++++++
 .../activemq/jms/pool/XAConnectionPoolTest.java | 26 ++++++++++++++--
 .../activemq/pool/XAConnectionPoolTest.java     | 31 +++++++++----------
 5 files changed, 81 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/577b29c0/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/GenericResourceManager.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/GenericResourceManager.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/GenericResourceManager.java
index b903906..48963ac 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/GenericResourceManager.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/GenericResourceManager.java
@@ -151,7 +151,12 @@ public class GenericResourceManager {
                     @Override
                     public NamedXAResource getNamedXAResource() throws SystemException {
                         try {
-                            final XAConnection xaConnection = connFactory.createXAConnection(rm.getUserName(), rm.getPassword());
+                            final XAConnection xaConnection;
+                            if (rm.getUserName() != null && rm.getPassword() != null) {
+                                xaConnection = connFactory.createXAConnection(rm.getUserName(), rm.getPassword());
+                            } else {
+                                xaConnection = connFactory.createXAConnection();
+                            }
                             final XASession session = xaConnection.createXASession();
                             xaConnection.start();
                             LOGGER.debug("new namedXAResource's connection: " + xaConnection);

http://git-wip-us.apache.org/repos/asf/activemq/blob/577b29c0/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
index 16f2701..83807f9 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
@@ -26,7 +26,6 @@ import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
 import javax.jms.TopicConnection;
 import javax.jms.TopicConnectionFactory;
-import javax.jms.XAConnectionFactory;
 
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericKeyedObjectPool;
@@ -68,7 +67,7 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti
     protected final AtomicBoolean stopped = new AtomicBoolean(false);
     private GenericKeyedObjectPool<ConnectionKey, ConnectionPool> connectionsPool;
 
-    private ConnectionFactory connectionFactory;
+    protected Object connectionFactory;
 
     private int maximumActiveSessionPerConnection = 500;
     private int idleTimeout = 30 * 1000;
@@ -156,7 +155,7 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti
     /**
      * @return the currently configured ConnectionFactory used to create the pooled Connections.
      */
-    public ConnectionFactory getConnectionFactory() {
+    public Object getConnectionFactory() {
         return connectionFactory;
     }
 
@@ -170,20 +169,11 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti
      * @param toUse
      *      The factory to use to create pooled Connections.
      */
-    public void setConnectionFactory(final ConnectionFactory toUse) {
-        if (toUse instanceof XAConnectionFactory) {
-            connectionFactory = new ConnectionFactory() {
-                @Override
-                public Connection createConnection() throws JMSException {
-                    return ((XAConnectionFactory)toUse).createXAConnection();
-                }
-                @Override
-                public Connection createConnection(String userName, String password) throws JMSException {
-                    return ((XAConnectionFactory)toUse).createXAConnection(userName, password);
-                }
-            };
-        } else {
+    public void setConnectionFactory(final Object toUse) {
+        if (toUse instanceof ConnectionFactory) {
             this.connectionFactory = toUse;
+        } else {
+            throw new IllegalArgumentException("connectionFactory should implement javax.jmx.ConnectionFactory");
         }
     }
 
@@ -278,10 +268,14 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti
     }
 
     protected Connection createConnection(ConnectionKey key) throws JMSException {
-        if (key.getUserName() == null && key.getPassword() == null) {
-            return connectionFactory.createConnection();
+        if (connectionFactory instanceof ConnectionFactory) {
+            if (key.getUserName() == null && key.getPassword() == null) {
+                return ((ConnectionFactory) connectionFactory).createConnection();
+            } else {
+                return ((ConnectionFactory) connectionFactory).createConnection(key.getUserName(), key.getPassword());
+            }
         } else {
-            return connectionFactory.createConnection(key.getUserName(), key.getPassword());
+            throw new IllegalStateException("connectionFactory should implement javax.jms.ConnectionFactory");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/577b29c0/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
index d5fbc60..a5d5aea 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/XaPooledConnectionFactory.java
@@ -20,6 +20,8 @@ import java.io.Serializable;
 import java.util.Hashtable;
 
 import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.XAConnectionFactory;
 import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -62,6 +64,28 @@ public class XaPooledConnectionFactory extends PooledConnectionFactory implement
     }
 
     @Override
+    public void setConnectionFactory(Object toUse) {
+        if (toUse instanceof XAConnectionFactory) {
+            connectionFactory = toUse;
+        } else {
+            throw new IllegalArgumentException("connectionFactory should implement javax.xml.XAConnectionFactory");
+        }
+    }
+
+    @Override
+    protected Connection createConnection(ConnectionKey key) throws JMSException {
+        if (connectionFactory instanceof XAConnectionFactory) {
+            if (key.getUserName() == null && key.getPassword() == null) {
+                return ((XAConnectionFactory) connectionFactory).createXAConnection();
+            } else {
+                return ((XAConnectionFactory) connectionFactory).createXAConnection(key.getUserName(), key.getPassword());
+            }
+        } else {
+            throw new IllegalStateException("connectionFactory should implement javax.jms.XAConnectionFactory");
+        }
+    }
+
+    @Override
     protected ConnectionPool createConnectionPool(Connection connection) {
         return new XaConnectionPool(connection, getTransactionManager());
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/577b29c0/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
index daf3af5..c56f8de 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
@@ -19,6 +19,7 @@ package org.apache.activemq.jms.pool;
 import java.util.Hashtable;
 import java.util.Vector;
 
+import javax.jms.JMSException;
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
 import javax.jms.QueueSender;
@@ -28,6 +29,8 @@ import javax.jms.TopicConnection;
 import javax.jms.TopicConnectionFactory;
 import javax.jms.TopicPublisher;
 import javax.jms.TopicSession;
+import javax.jms.XAConnection;
+import javax.jms.XAConnectionFactory;
 import javax.naming.spi.ObjectFactory;
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
@@ -53,8 +56,7 @@ public class XAConnectionPoolTest extends TestSupport {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
-
+        pcf.setConnectionFactory(new XAConnectionFactoryOnly(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false")));
         // simple TM that is in a tx and will track syncs
         pcf.setTransactionManager(new TransactionManager(){
             @Override
@@ -154,7 +156,7 @@ public class XAConnectionPoolTest extends TestSupport {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE));
+        pcf.setConnectionFactory(new XAConnectionFactoryOnly(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE)));
 
         // simple TM that is in a tx and will track syncs
         pcf.setTransactionManager(new TransactionManager(){
@@ -345,4 +347,22 @@ public class XAConnectionPoolTest extends TestSupport {
 
         connection.close();
     }
+
+    static class XAConnectionFactoryOnly implements XAConnectionFactory {
+        private final XAConnectionFactory connectionFactory;
+
+        XAConnectionFactoryOnly(XAConnectionFactory connectionFactory) {
+            this.connectionFactory = connectionFactory;
+        }
+
+        @Override
+        public XAConnection createXAConnection() throws JMSException {
+            return connectionFactory.createXAConnection();
+        }
+
+        @Override
+        public XAConnection createXAConnection(String userName, String password) throws JMSException {
+            return connectionFactory.createXAConnection(userName, password);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/577b29c0/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
index 8223f2d..9c85cde 100644
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
+++ b/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
@@ -18,6 +18,7 @@ package org.apache.activemq.pool;
 
 import java.util.Hashtable;
 import java.util.Vector;
+
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
 import javax.jms.QueueSender;
@@ -39,9 +40,8 @@ import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;
-import org.apache.activemq.ActiveMQConnectionFactory;
+
 import org.apache.activemq.ActiveMQXAConnectionFactory;
-import org.apache.activemq.ActiveMQXASession;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.jms.pool.PooledSession;
 import org.apache.activemq.test.TestSupport;
@@ -53,16 +53,17 @@ public class XAConnectionPoolTest extends TestSupport {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
 
         // simple TM that is in a tx and will track syncs
-        pcf.setTransactionManager(new TransactionManager(){
+        pcf.setTransactionManager(new TransactionManager() {
             @Override
             public void begin() throws NotSupportedException, SystemException {
             }
 
             @Override
-            public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
+            public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException,
+                SystemException {
             }
 
             @Override
@@ -105,7 +106,6 @@ public class XAConnectionPoolTest extends TestSupport {
                     public void setRollbackOnly() throws IllegalStateException, SystemException {
                     }
                 };
-
             }
 
             @Override
@@ -134,8 +134,6 @@ public class XAConnectionPoolTest extends TestSupport {
         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());
@@ -157,13 +155,14 @@ public class XAConnectionPoolTest extends TestSupport {
         pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE));
 
         // simple TM that is in a tx and will track syncs
-        pcf.setTransactionManager(new TransactionManager(){
+        pcf.setTransactionManager(new TransactionManager() {
             @Override
             public void begin() throws NotSupportedException, SystemException {
             }
 
             @Override
-            public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
+            public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException,
+                SystemException {
             }
 
             @Override
@@ -206,7 +205,6 @@ public class XAConnectionPoolTest extends TestSupport {
                     public void setRollbackOnly() throws IllegalStateException, SystemException {
                     }
                 };
-
             }
 
             @Override
@@ -248,7 +246,7 @@ public class XAConnectionPoolTest extends TestSupport {
         connection.close();
     }
 
-    public void testInstanceOf() throws  Exception {
+    public void testInstanceOf() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
         assertTrue(pcf instanceof QueueConnectionFactory);
         assertTrue(pcf instanceof TopicConnectionFactory);
@@ -257,7 +255,7 @@ public class XAConnectionPoolTest extends TestSupport {
     public void testBindable() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
         assertTrue(pcf instanceof ObjectFactory);
-        assertTrue(((ObjectFactory)pcf).getObjectInstance(null, null, null, null) instanceof XaPooledConnectionFactory);
+        assertTrue(((ObjectFactory) pcf).getObjectInstance(null, null, null, null) instanceof XaPooledConnectionFactory);
         assertTrue(pcf.isTmFromJndi());
     }
 
@@ -272,7 +270,7 @@ public class XAConnectionPoolTest extends TestSupport {
 
     public void testSenderAndPublisherDest() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
 
         QueueConnection connection = pcf.createQueueConnection();
         QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -291,7 +289,7 @@ public class XAConnectionPoolTest extends TestSupport {
 
     public void testSessionArgsIgnoredWithTm() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
         // simple TM that with no tx
         pcf.setTransactionManager(new TransactionManager() {
             @Override
@@ -300,7 +298,8 @@ public class XAConnectionPoolTest extends TestSupport {
             }
 
             @Override
-            public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
+            public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException,
+                SystemException {
                 throw new IllegalStateException("NoTx");
             }