@Override
  public CleanupResult cleanup(TimeBasedCleanupPolicy cleanupPolicy) {
    long affectedRows = 0;
    int errorCount = 0;
    for (Cleanable cleanable : cleanables) {
      LOGGER.info("Running the purge process for DAO: [{}] with cleanup policy: [{}]", cleanable, cleanupPolicy);
      try {
        affectedRows += cleanable.cleanup(cleanupPolicy);
      }
      catch (Exception ex) {
        LOGGER.error("Running the purge process for DAO: [{}] failed with: {}", cleanable, ex);
        errorCount++;
      }
    }

    return new Result(affectedRows, errorCount);
  }
Triggers the cleanup process on the registered DAOs.

@param cleanupPolicy the policy based on which the cleanup is done
@return the number of affected rows
ambari-server/src/main/java/org/apache/ambari/server/cleanup/CleanupServiceImpl.java