docs: protected void cleanupSfDumps(boolean deleteOldest)
    {
      // Check what the maximum number of dumpfiles and the max allowable
      // aggregate dump file size is.
      int maxDumpFiles =
          System.getProperty(MAX_NUM_DUMP_FILES_PROP) != null ?
          Integer.valueOf(System.getProperty(MAX_NUM_DUMP_FILES_PROP)) :
          DEFAULT_MAX_DUMP_FILES;
  
      int maxDumpDirSizeMB =
          System.getProperty(MAX_SIZE_DUMPS_MB_PROP) != null ?
          Integer.valueOf(System.getProperty(MAX_SIZE_DUMPS_MB_PROP)) :
          DEFAULT_MAX_DUMPDIR_SIZE_MB;
  
      File dumpDir = new File(logDumpPathPrefix);
      long dirSizeBytes = 0;
  
      if (dumpDir.listFiles() == null)
      {
        return;
      }
  
      // Keep a sorted list of files by size as we go in case we need to
      // delete some
      TreeSet<File> fileList =
          new TreeSet<>(new Comparator<File>()
          {
            @Override
            public int compare(File a, File b)
            {
              return a.length() < b.length() ? -1 : 1;
            }
          });
  
      // Loop over files in this directory and get rid of old ones
      // while accumulating the total size
      for (File file : dumpDir.listFiles())
      {
        if ((!file.getName().startsWith(LOG_DUMP_FILE_NAME) &&
             !file.getName().startsWith(IncidentUtil.INC_DUMP_FILE_NAME)) ||
            (System.currentTimeMillis() - file.lastModified() > FILE_EXPN_TIME_MS &&
             file.delete()))
        {
          continue;
        }
  
        dirSizeBytes += file.length();
        fileList.add(file);
      }
  
      // If we're exceeding our max allotted disk usage, cut some stuff out;
      // else if we need to make space for a new dump delete the oldest.
      if (dirSizeBytes >= ((long) maxDumpDirSizeMB << 20))
      {
        // While we take up more than half the allotted disk usage, keep deleting.
        for (File file : fileList)
        {
          if (dirSizeBytes < ((long) maxDumpDirSizeMB << 19))
          {
            break;
          }
  
          long victimSize = file.length();
          if (file.delete())
          {
            dirSizeBytes -= victimSize;
          }
        }
      }
      else if (deleteOldest && fileList.size() >= maxDumpFiles)
      {
        fileList.first().delete();
      }
    }