activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franz1981 <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #2369: ARTEMIS-2123 Paging not stopped if ther...
Date Mon, 15 Oct 2018 08:27:43 GMT
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2369#discussion_r225077165
  
    --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
---
    @@ -599,6 +600,29 @@ private long checkMinPage(Collection<PageSubscription> cursorList)
{
     
        }
     
    +   private void deliverIfNecessary(Collection<PageSubscription> cursorList) {
    +      long minPage = Long.MAX_VALUE;
    +      PageSubscription slowSubscription = null;
    +      int nonEmptyCursorNum = 0;
    +
    +      for (PageSubscription cursor : cursorList) {
    +         long firstPage = cursor.getFirstPage();
    +
    +         // the cursor will return -1 if the cursor is empty
    +         if (firstPage >= 0) {
    +            nonEmptyCursorNum++;
    +            if (firstPage < minPage) {
    +               minPage = firstPage;
    +               slowSubscription = cursor.getQueue().getMessageCount() == 0 ? cursor :
null;
    +            }
    +         }
    +      }
    +
    +      if (nonEmptyCursorNum > 1 && slowSubscription != null) {
    --- End diff --
    
    @wy96f nice! So please change the code with the refined version of `deliverIfNecessary`
and squash the commits into one :+1: 


---

Mime
View raw message