code: protected long scanPagesToSend(long maxClientReplicatedPageVersion, FastUnsafeOffHeapIntList pagesToSend)
      {
          long maxPageVersion = 0;
          boolean upgraded = false;
          for(int i=0;i<this.pageVersionList.size();i++)
          {
              if (pageVersionList.get(i) == 0 && !upgraded)
              {
                  boolean originalLockWasReleased = this.readWriteLock.upgradeToWriteLock();
                  this.currentPageVersion++;
                  if (originalLockWasReleased)
                  {
                      pagesToSend.clear();
                      for(int j=0;j<i;j++)
                      {
                          maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, j);
                      }
                  }
                  upgraded = true;
              }
              maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, i);
          }
          return maxPageVersion;
      }
docs: Method is protected for testing purposes only