private boolean deleteAction(Action<Boolean> deletion, String type, Path dir) {
    boolean deleted;
    try {
      LOG.trace("Start deleting {} under {}", type, dir);
      deleted = deletion.act();
    } catch (PathIsNotEmptyDirectoryException exception) {
      // N.B. HDFS throws this exception when we try to delete a non-empty directory, but
      // LocalFileSystem throws a bare IOException. So some test code will get the verbose
      // message below.
      LOG.debug("Couldn't delete '{}' yet because it isn't empty w/exception.", dir, exception);
      deleted = false;
    } catch (IOException ioe) {
      if (LOG.isTraceEnabled()) {
        LOG.trace("Could not delete {} under {}; will retry. If it keeps happening, "
          + "quote the exception when asking on mailing list.", type, dir, ioe);
      } else {
        LOG.info(
          "Could not delete {} under {} because {}; will retry. If it  keeps happening, enable"
            + "TRACE-level logging and quote the exception when asking on mailing list.",
          type, dir, ioe.getMessage());
      }
      deleted = false;
    } catch (Exception e) {
      LOG.info("unexpected exception: ", e);
      deleted = false;
    }
    LOG.trace("Finish deleting {} under {}, deleted = {}", type, dir, deleted);
    return deleted;
  }
Perform a delete on a specified type.
@param deletion a delete
@param type     possible values are 'files', 'subdirs', 'dirs'
@return true if it deleted successfully, false otherwise
hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java