cshannon commented on code in PR #2197:
URL: https://github.com/apache/activemq/pull/2197#discussion_r3545700993


##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java:
##########
@@ -2113,8 +2113,13 @@ private PendingList doPageInForDispatch(boolean force, 
boolean processExpired, i
             pagedInPendingDispatchLock.readLock().unlock();
         }
         if (isLazyDispatch() && !force) {
-            // Only page in the minimum number of messages which can be
-            // dispatched immediately.
+            toPageIn = Math.min(toPageIn, getConsumerMessageCountBeforeFull());

Review Comment:
   getConsumerMessageCountBeforeFull() is an expensive operation and has to 
iterate, it should be called one time and not 3 times and result saved



##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java:
##########
@@ -2113,8 +2113,13 @@ private PendingList doPageInForDispatch(boolean force, 
boolean processExpired, i
             pagedInPendingDispatchLock.readLock().unlock();
         }
         if (isLazyDispatch() && !force) {
-            // Only page in the minimum number of messages which can be
-            // dispatched immediately.
+            toPageIn = Math.min(toPageIn, getConsumerMessageCountBeforeFull());
+        }
+        if (pagedInPendingSize >= maxPageSize && !force) {

Review Comment:
   Shouldn't this be an if/else so you aren't doing the same thing twice?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to