activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1378859 - in /activemq/trunk/activemq-pool/src: main/java/org/apache/activemq/pool/ test/java/org/apache/activemq/pool/
Date Thu, 30 Aug 2012 08:54:15 GMT
Author: davsclaus
Date: Thu Aug 30 08:54:15 2012
New Revision: 1378859

URL: http://svn.apache.org/viewvc?rev=1378859&view=rev
Log:
AMQ-4004: The option maximumActive has been name a more descriptive name to not confuse end
users. The old name is kept but is @deprecated to be backwards compatible.

Modified:
    activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/AmqJNDIPooledConnectionFactory.java
    activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
    activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
    activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java

Modified: activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/AmqJNDIPooledConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/AmqJNDIPooledConnectionFactory.java?rev=1378859&r1=1378858&r2=1378859&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/AmqJNDIPooledConnectionFactory.java
(original)
+++ activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/AmqJNDIPooledConnectionFactory.java
Thu Aug 30 08:54:15 2012
@@ -89,6 +89,10 @@ public class AmqJNDIPooledConnectionFact
         if (temp != null && temp.length() > 0) {
             setMaximumActive(Integer.parseInt(temp));
         }
+        temp = properties.getProperty("maximumActiveSessionPerConnection");
+        if (temp != null && temp.length() > 0) {
+            setMaximumActiveSessionPerConnection(Integer.parseInt(temp));
+        }
         temp = properties.getProperty("maxConnections");
         if (temp != null && temp.length() > 0) {
             setMaxConnections(Integer.parseInt(temp));
@@ -98,9 +102,10 @@ public class AmqJNDIPooledConnectionFact
     public void populateProperties(Properties props) {
         ((ActiveMQConnectionFactory) getConnectionFactory())
                 .populateProperties(props);
-        props
-                .setProperty("maximumActive", Integer
-                        .toString(getMaximumActive()));
+        props.setProperty("maximumActive", Integer
+                .toString(getMaximumActive()));
+        props.setProperty("maximumActiveSessionPerConnection", Integer
+                .toString(getMaximumActiveSessionPerConnection()));
         props.setProperty("maxConnections", Integer
                 .toString(getMaxConnections()));
     }

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=1378859&r1=1378858&r2=1378859&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
Thu Aug 30 08:54:15 2012
@@ -63,7 +63,7 @@ public class PooledConnectionFactory imp
     private ConnectionFactory connectionFactory;
     private final Map<ConnectionKey, LinkedList<ConnectionPool>> cache = new
HashMap<ConnectionKey, LinkedList<ConnectionPool>>();
     private ObjectPoolFactory poolFactory;
-    private int maximumActive = 500;
+    private int maximumActiveSessionPerConnection = 500;
     private int maxConnections = 1;
     private int idleTimeout = 30 * 1000;
     private boolean blockIfSessionPoolIsFull = true;
@@ -193,15 +193,31 @@ public class PooledConnectionFactory imp
         this.poolFactory = poolFactory;
     }
 
+    /**
+     * @deprecated use {@link #getMaximumActiveSessionPerConnection()}
+     */
+    @Deprecated
     public int getMaximumActive() {
-        return maximumActive;
+        return getMaximumActiveSessionPerConnection();
     }
 
     /**
-     * Sets the maximum number of active sessions per connection
+     * @deprecated use {@link #setMaximumActiveSessionPerConnection(int)}
      */
+    @Deprecated
     public void setMaximumActive(int maximumActive) {
-        this.maximumActive = maximumActive;
+        setMaximumActiveSessionPerConnection(maximumActive);
+    }
+
+    public int getMaximumActiveSessionPerConnection() {
+        return maximumActiveSessionPerConnection;
+    }
+
+    /**
+     * Sets the maximum number of active sessions per connection
+     */
+    public void setMaximumActiveSessionPerConnection(int maximumActiveSessionPerConnection)
{
+        this.maximumActiveSessionPerConnection = maximumActiveSessionPerConnection;
     }
 
     /**
@@ -242,10 +258,10 @@ public class PooledConnectionFactory imp
      */
     protected ObjectPoolFactory createPoolFactory() {
          if (blockIfSessionPoolIsFull) {
-            return new GenericObjectPoolFactory(null, maximumActive);
+            return new GenericObjectPoolFactory(null, maximumActiveSessionPerConnection);
         } else {
             return new GenericObjectPoolFactory(null,
-                maximumActive,
+                maximumActiveSessionPerConnection,
                 GenericObjectPool.WHEN_EXHAUSTED_FAIL,
                 GenericObjectPool.DEFAULT_MAX_WAIT);
         }

Modified: activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java?rev=1378859&r1=1378858&r2=1378859&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
(original)
+++ activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
Thu Aug 30 08:54:15 2012
@@ -91,7 +91,7 @@ public class PooledConnectionFactoryMaxi
         ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
         PooledConnectionFactory cf = new PooledConnectionFactory(amq);
         cf.setMaxConnections(3);
-        cf.setMaximumActive(1);
+        cf.setMaximumActiveSessionPerConnection(1);
         cf.setBlockIfSessionPoolIsFull(true);
         conn = cf.createConnection();
 

Modified: activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java?rev=1378859&r1=1378858&r2=1378859&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java
(original)
+++ activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java
Thu Aug 30 08:54:15 2012
@@ -109,7 +109,7 @@ class TestRunner implements Callable<Boo
             ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
             PooledConnectionFactory cf = new PooledConnectionFactory(amq);
             cf.setMaxConnections(3);
-            cf.setMaximumActive(1);
+            cf.setMaximumActiveSessionPerConnection(1);
             cf.setBlockIfSessionPoolIsFull(false);
 
             conn = cf.createConnection();



Mime
View raw message