Repository: activemq Updated Branches: refs/heads/master 450a5226e -> 7c7c50505
https://issues.apache.org/jira/browse/AMQ-5990 Disabling JMX for the Commons Pool implementation inside of PooledConnectionFactory. In the future if we want JMX we should enable our own JMX stats that are independent of Commons Pool. Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/7c7c5050 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/7c7c5050 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/7c7c5050 Branch: refs/heads/master Commit: 7c7c505057ec350eada8d5194b7e30337277f9b2 Parents: 450a522 Author: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Authored: Thu Oct 1 18:08:37 2015 +0000 Committer: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Committed: Thu Oct 1 18:08:37 2015 +0000 ---------------------------------------------------------------------- .../java/org/apache/activemq/jms/pool/ConnectionPool.java | 9 ++++----- .../apache/activemq/jms/pool/PooledConnectionFactory.java | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/7c7c5050/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java ---------------------------------------------------------------------- diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java index 6b6fe65..15bdd33 100644 --- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java +++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java @@ -29,13 +29,11 @@ import javax.jms.Session; import javax.jms.TemporaryQueue; import javax.jms.TemporaryTopic; -import org.apache.commons.pool2.BasePooledObjectFactory; -import org.apache.commons.pool2.KeyedObjectPool; import org.apache.commons.pool2.KeyedPooledObjectFactory; import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.impl.DefaultPooledObject; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; -import org.apache.commons.pool2.impl.GenericObjectPool; +import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,7 +64,8 @@ public class ConnectionPool implements ExceptionListener { private ExceptionListener parentExceptionListener; public ConnectionPool(Connection connection) { - + final GenericKeyedObjectPoolConfig poolConfig = new GenericKeyedObjectPoolConfig(); + poolConfig.setJmxEnabled(false); this.connection = wrap(connection); // Create our internal Pool of session instances. @@ -95,7 +94,7 @@ public class ConnectionPool implements ExceptionListener { @Override public void passivateObject(SessionKey sessionKey, PooledObject<SessionHolder> pooledObject) throws Exception { } - } + }, poolConfig ); } http://git-wip-us.apache.org/repos/asf/activemq/blob/7c7c5050/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 ab251c5..f507cda 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 @@ -32,6 +32,7 @@ import org.apache.commons.pool2.KeyedPooledObjectFactory; import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.impl.DefaultPooledObject; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; +import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,6 +87,8 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti public void initConnectionsPool() { if (this.connectionsPool == null) { + final GenericKeyedObjectPoolConfig poolConfig = new GenericKeyedObjectPoolConfig(); + poolConfig.setJmxEnabled(false); this.connectionsPool = new GenericKeyedObjectPool<ConnectionKey, ConnectionPool>( new KeyedPooledObjectFactory<ConnectionKey, ConnectionPool>() { @Override @@ -147,7 +150,7 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti public void passivateObject(ConnectionKey connectionKey, PooledObject<ConnectionPool> pooledObject) throws Exception { } - }); + }, poolConfig); // Set max idle (not max active) since our connections always idle in the pool. this.connectionsPool.setMaxIdlePerKey(1);