@Override
  public synchronized void purge(long period, int intervalBetweenActivities, Consumer<? super ChangeSet> processor) {
    if (isCompletelyBroken) return;

    IntSet recursionGuard = new IntOpenHashSet(1000);

    try {
      int firstObsoleteId = findFirstObsoleteBlock(period, intervalBetweenActivities, recursionGuard);
      if (firstObsoleteId == 0) return;

      int eachBlockId = firstObsoleteId;

      while (eachBlockId != 0) {
        processor.consume(doReadBlock(eachBlockId).changeSet());
        eachBlockId = doReadPrevSafely(eachBlockId, recursionGuard);
      }
      myStorage.deleteRecordsUpTo(firstObsoleteId);
      force();
    }
    catch (IOException e) {
      handleError(e, null);
    }
  }
@Override
  public synchronized void purge(long period, int intervalBetweenActivities, Consumer<? super ChangeSet> processor)