[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
This commit is contained in:
Shailendra Kumar Singh 2018-05-24 17:24:44 +05:30 committed by Clebert Suconic
parent ca589f316b
commit 390a07e391
1 changed files with 1 additions and 5 deletions

View File

@ -266,8 +266,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
private final AddressInfo addressInfo; private final AddressInfo addressInfo;
private final AtomicInteger noConsumers = new AtomicInteger(0);
private volatile RoutingType routingType; private volatile RoutingType routingType;
private final QueueFactory factory; private final QueueFactory factory;
@ -881,7 +879,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
try { try {
synchronized (this) { synchronized (this) {
if (maxConsumers != MAX_CONSUMERS_UNLIMITED && noConsumers.get() >= maxConsumers) { if (maxConsumers != MAX_CONSUMERS_UNLIMITED && consumersCount.get() >= maxConsumers) {
throw ActiveMQMessageBundle.BUNDLE.maxConsumerLimitReachedForQueue(address, name); throw ActiveMQMessageBundle.BUNDLE.maxConsumerLimitReachedForQueue(address, name);
} }
@ -903,7 +901,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
refCountForConsumers.increment(); refCountForConsumers.increment();
} }
noConsumers.incrementAndGet();
} }
} finally { } finally {
leaveCritical(CRITICAL_CONSUMER); leaveCritical(CRITICAL_CONSUMER);
@ -964,7 +961,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
refCountForConsumers.decrement(); refCountForConsumers.decrement();
} }
noConsumers.decrementAndGet();
} }
} finally { } finally {
leaveCritical(CRITICAL_CONSUMER); leaveCritical(CRITICAL_CONSUMER);