コード例 #1
0
  /** This method is synchronized because we want it to be atomic with the cursors being used */
  private long checkMinPage(Collection<PageSubscription> cursorList) {
    long minPage = Long.MAX_VALUE;

    for (PageSubscription cursor : cursorList) {
      long firstPage = cursor.getFirstPage();
      if (HornetQServerLogger.LOGGER.isDebugEnabled()) {
        HornetQServerLogger.LOGGER.debug(
            this.pagingStore.getAddress()
                + " has a cursor "
                + cursor
                + " with first page="
                + firstPage);
      }

      // the cursor will return -1 if the cursor is empty
      if (firstPage >= 0 && firstPage < minPage) {
        minPage = firstPage;
      }
    }

    if (HornetQServerLogger.LOGGER.isDebugEnabled()) {
      HornetQServerLogger.LOGGER.debug(this.pagingStore.getAddress() + " has minPage=" + minPage);
    }

    return minPage;
  }
コード例 #2
0
  /** This method is synchronized because we want it to be atomic with the cursors being used */
  private long checkMinPage(List<PageSubscription> cursorList) {
    long minPage = Long.MAX_VALUE;

    for (PageSubscription cursor : cursorList) {
      long firstPage = cursor.getFirstPage();
      if (log.isDebugEnabled()) {
        log.debug(
            this.pagingStore.getAddress()
                + " has a cursor "
                + cursor
                + " with first page="
                + firstPage);
      }
      if (firstPage < minPage) {
        minPage = firstPage;
      }
    }

    if (log.isDebugEnabled()) {
      log.debug(this.pagingStore.getAddress() + " has minPage=" + minPage);
    }

    return minPage;
  }