void getCompactableOplogs(List<CompactableOplog> compactableOplogs, int max) {
    synchronized (getOplogIdToOplog()) {
      for (Oplog oplog : getOplogIdToOplog().values()) {
        if (compactableOplogs.size() >= max) {
          return;
        }
        if (oplog.needsCompaction()) {
          compactableOplogs.add(oplog);
        }
      }
    }
  }
Add compactable oplogs to the list, up to the maximum size.
geode-core/src/main/java/org/apache/geode/internal/cache/PersistentOplogSet.java