activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-5649
Date Mon, 13 Apr 2015 14:28:26 GMT
Repository: activemq
Updated Branches:
  refs/heads/master f0ebda7ef -> ec9a92f6f


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

Ensures that max producers on a connection includes anonymous producers
in its count, based on patch from: Christopher L. Shannon (cshannon)
<christopher.l.shannon@gmail.com>

Merged the test into the existing ConfigTest that validates the max
producers functionality.

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

Branch: refs/heads/master
Commit: ec9a92f6fc5554017e1b3551b24e2e19e0da8fbc
Parents: f0ebda7
Author: Timothy Bish <tabish121@gmail.com>
Authored: Mon Apr 13 10:25:51 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Mon Apr 13 10:25:51 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/activemq/broker/TransportConnection.java  | 5 ++++-
 .../src/test/java/org/apache/activemq/config/ConfigTest.java  | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/ec9a92f6/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
index 7f9fa6c..5c6307a 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
@@ -602,7 +602,10 @@ public class TransportConnection implements Connection, Task, CommandVisitor
{
         // Avoid replaying dup commands
         if (!ss.getProducerIds().contains(info.getProducerId())) {
             ActiveMQDestination destination = info.getDestination();
-            if (destination != null && !AdvisorySupport.isAdvisoryTopic(destination))
{
+            // Do not check for null here as it would cause the count of max producers to
exclude
+            // anonymous producers.  The isAdvisoryTopic method checks for null so it is
safe to
+            // call it from here with a null Destination value.
+            if (!AdvisorySupport.isAdvisoryTopic(destination)) {
                 if (getProducerCount(connectionId) >= connector.getMaximumProducersAllowedPerConnection()){
                     throw new IllegalStateException("Can't add producer on connection " +
connectionId + ": at maximum limit: " + connector.getMaximumProducersAllowedPerConnection());
                 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/ec9a92f6/activemq-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
index 82b5ebe..a62ce07 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
@@ -383,6 +383,13 @@ public class ConfigTest {
             } catch (JMSException expected) {
             }
 
+            // Tests the anonymous producer case also counts.
+            try {
+                session.createProducer(null);
+                fail("Should have got an exception on exceeding MAX_PRODUCERS");
+            } catch (JMSException expected) {
+            }
+
             try {
                 for (int i = 0; i < (MAX_CONSUMERS + 1); i++) {
                     MessageConsumer consumer = session.createConsumer(topic);


Mime
View raw message