code: private void maybeCheckpoint() {
      if (mShutdownInitiated) {
        return;
      }
      long nextSequenceNumber = mJournalReader.getNextSequenceNumber();
      if (nextSequenceNumber - mNextSequenceNumberToCheckpoint < mCheckpointPeriodEntries) {
        return;
      }
      try {
        mNextSequenceNumberToCheckpoint = mJournal.getNextSequenceNumberToCheckpoint();
      } catch (IOException e) {
        LOG.warn("{}: Failed to get the next sequence number to checkpoint with error {}.",
            mMaster.getName(), e.getMessage());
        return;
      }
      if (nextSequenceNumber - mNextSequenceNumberToCheckpoint < mCheckpointPeriodEntries) {
        return;
      }
  
      writeCheckpoint(nextSequenceNumber);
    }
docs: Creates a new checkpoint if necessary.