protected <T> T executeQuery(String tableName, String[] requestedColumnNames,
                               String[] conditionColumnNames, String[] conditionValues,
                               boolean ignoreFailure, ResultGetter<T> resultGetter) throws SQLException {

    // Build the query...
    String query = buildQuery(tableName, requestedColumnNames, conditionColumnNames, conditionValues);

    // Execute the query
    Statement statement = getConnection().createStatement();
    ResultSet resultSet = null;
    try {
      resultSet = statement.executeQuery(query);
      if (resultSet != null) {
        while (resultSet.next()) {
          resultGetter.collect(resultSet);
        }
      }
    } catch (SQLException e) {
      LOG.warn("Unable to execute query: " + query, e);
      if (!ignoreFailure) {
        throw e;
      }
    } finally {
      if (resultSet != null) {
        resultSet.close();
      }
      if (statement != null) {
        statement.close();
      }
    }

    return resultGetter.getResult();
  }
Executes a query returning data as specified by the {@link ResultGetter} implementation.

@param tableName            the table name
@param requestedColumnNames an array of column names to select
@param conditionColumnNames an array of column names to use in the where clause
@param conditionValues      an array of value to pair with the column names in conditionColumnNames
@param ignoreFailure        true to ignore failures executing the query; false otherwise (errors building the query will be thrown, however)
@param resultGetter         a {@link ResultGetter} implementation used to format the data into the expected return value
@return the result from the resultGetter
@throws SQLException
ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java