You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/08/31 16:53:10 UTC

[GitHub] [activemq-artemis] gtully commented on a change in pull request #3635: ARTEMIS-2007 - allow redistribution if there are unmatched messages p…

gtully commented on a change in pull request #3635:
URL: https://github.com/apache/activemq-artemis/pull/3635#discussion_r699508891



##########
File path: artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
##########
@@ -1567,7 +1566,14 @@ protected void finalize() throws Throwable {
 
    @Override
    public int getConsumerCount() {
-      return consumers.size();
+      // we don't want to count the redistributor, it is an internal transient entry in the consumer list
+      // check for presence before checking consumers to align with use of set()
+      final boolean compensateForPresenceOfRedistributor = redistributorUpdater.get(this) != null;
+      int size = consumers.size();
+      if (size > 0 && compensateForPresenceOfRedistributor) {
+         size--;
+      }
+      return size;

Review comment:
       @gemmellr I like that suggestion. Thanks! I will peek at doing the compensation in size() and have consumers track the redistributor that it contains, it should be a lot cleaner.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org