List<JournalEntry> getEntriesSince(Offset offset, boolean inclusive) {
    // To prevent synchronizing the addEntry method, we first get all the entries from the journal that are greater
    // than offset. Once we have all the required entries, we finally check if the offset is actually present
    // in the journal. If the offset is not present we return null, else we return the entries we got in the first step.
    // The offset may not be present in the journal as it could be removed.

    Map.Entry<Offset, StoreKey> first = journal.firstEntry();
    Map.Entry<Offset, StoreKey> last = journal.lastEntry();

    // check if the journal contains the offset.
    if (first == null || offset.compareTo(first.getKey()) < 0 || last == null || offset.compareTo(last.getKey()) > 0
        || !journal.containsKey(offset)) {
      return null;
    }

    ConcurrentNavigableMap<Offset, StoreKey> subsetMap = journal.tailMap(offset, true);
    int entriesToReturn = Math.min(subsetMap.size(), maxEntriesToReturn);
    List<JournalEntry> journalEntries = new ArrayList<JournalEntry>(entriesToReturn);
    int entriesAdded = 0;
    for (Map.Entry<Offset, StoreKey> entry : subsetMap.entrySet()) {
      if (inclusive || !entry.getKey().equals(offset)) {
        journalEntries.add(new JournalEntry(entry.getKey(), entry.getValue()));
        entriesAdded++;
        if (entriesAdded == entriesToReturn) {
          break;
        }
      }
    }

    // Ensure that the offset was not pushed out of the journal.
    first = journal.firstEntry();
    if (first == null || offset.compareTo(first.getKey()) < 0) {
      return null;
    }

    logger.trace("Journal : {} entries returned {}", dataDir, journalEntries.size());
    return journalEntries;
  }
Gets all the entries from the journal starting at the provided offset and till the maxEntriesToReturn or the
end of the journal is reached.
@param offset The {@link Offset} from where the journal needs to return entries.
@param inclusive if {@code true}, the returned entries (if not {@code null}), contain the entry at {@code offset}.
@return The entries in the journal starting from offset. If the offset is outside the range of the journal,
        it returns null.
ambry-store/src/main/java/com/github/ambry/store/Journal.java