[ARTEMIS-1885] max-consumers attribute in queue definition does not work for AMQP client.
Tests being added as part of another commit This closes #2106 Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/390a07e3 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/390a07e3 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/390a07e3 Branch: refs/heads/2.6.x Commit: 390a07e391e3b015914569c08012d3ffb55b17cf Parents: ca589f3 Author: Shailendra Kumar Singh <shailendra...@gmail.com> Authored: Thu May 24 17:24:44 2018 +0530 Committer: Clebert Suconic <clebertsuco...@apache.org> Committed: Thu May 24 14:36:23 2018 -0400 ---------------------------------------------------------------------- .../apache/activemq/artemis/core/server/impl/QueueImpl.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/390a07e3/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index dc77aad..94b7640 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -266,8 +266,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { private final AddressInfo addressInfo; - private final AtomicInteger noConsumers = new AtomicInteger(0); - private volatile RoutingType routingType; private final QueueFactory factory; @@ -881,7 +879,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { try { synchronized (this) { - if (maxConsumers != MAX_CONSUMERS_UNLIMITED && noConsumers.get() >= maxConsumers) { + if (maxConsumers != MAX_CONSUMERS_UNLIMITED && consumersCount.get() >= maxConsumers) { throw ActiveMQMessageBundle.BUNDLE.maxConsumerLimitReachedForQueue(address, name); } @@ -903,7 +901,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { refCountForConsumers.increment(); } - noConsumers.incrementAndGet(); } } finally { leaveCritical(CRITICAL_CONSUMER); @@ -964,7 +961,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { refCountForConsumers.decrement(); } - noConsumers.decrementAndGet(); } } finally { leaveCritical(CRITICAL_CONSUMER);