code: public void clean() throws IOException {
      List<Dataset> dataSets = this.datasetFinder.findDatasets();
      this.finishCleanSignal = Optional.of(new CountDownLatch(dataSets.size()));
      for (final Dataset dataset : dataSets) {
        ListenableFuture<Void> future = this.service.submit(new Callable<Void>() {
          @Override
          public Void call() throws Exception {
            if (dataset instanceof CleanableDataset) {
              ((CleanableDataset) dataset).clean();
            }
            return null;
          }
        });
        Futures.addCallback(future, new FutureCallback<Void>() {
          @Override
          public void onFailure(Throwable throwable) {
            DatasetCleaner.this.finishCleanSignal.get().countDown();
            LOG.warn("Exception caught when cleaning " + dataset.datasetURN() + ".", throwable);
            DatasetCleaner.this.throwables.add(throwable);
            Instrumented.markMeter(DatasetCleaner.this.datasetsCleanFailureMeter);
            DatasetCleaner.this.eventSubmitter.submit(RetentionEvents.CleanFailed.EVENT_NAME,
                ImmutableMap.of(RetentionEvents.CleanFailed.FAILURE_CONTEXT_METADATA_KEY,
                    ExceptionUtils.getFullStackTrace(throwable), RetentionEvents.DATASET_URN_METADATA_KEY,
                    dataset.datasetURN()));
          }
  
          @Override
          public void onSuccess(Void arg0) {
            DatasetCleaner.this.finishCleanSignal.get().countDown();
            LOG.info("Successfully cleaned: " + dataset.datasetURN());
            Instrumented.markMeter(DatasetCleaner.this.datasetsCleanSuccessMeter);
          }
        });
      }
    }
docs: Perform the cleanup of old / deprecated dataset versions.
  @throws IOException