private <T> T invokeWithRetry(Command<T> command) throws AmbariException, AuthorizationException {
    RetryHelper.clearAffectedClusters();
    int retryAttempts = RetryHelper.getOperationsRetryAttempts();
    do {

      try {
        return command.invoke();
      } catch (Exception e) {
        if (RetryHelper.isDatabaseException(e)) {

          RetryHelper.invalidateAffectedClusters();

          if (retryAttempts > 0) {
            LOG.error("Ignoring database exception to perform operation retry, attempts remaining: " + retryAttempts, e);
            retryAttempts--;
          } else {
            RetryHelper.clearAffectedClusters();
            throw e;
          }
        } else {
          RetryHelper.clearAffectedClusters();
          throw e;
        }
      }

    } while (true);
  }
Helper method to get a configuration request, if one exists.
@param parentCategory  the parent category name.  Checks for a property
   whose category is the parent and marked as a desired config.
@param properties  the properties on the request.
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java