From 390a07e391e3b015914569c08012d3ffb55b17cf Mon Sep 17 00:00:00 2001 From: Shailendra Kumar Singh Date: Thu, 24 May 2018 17:24:44 +0530 Subject: [PATCH] [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 --- .../apache/activemq/artemis/core/server/impl/QueueImpl.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 dc77aadddc..94b764029a 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);