public List scanMetricMetadataForWildCardRequest()

in ambari-metrics-timelineservice/src/main/java/org/apache/ambari/metrics/core/timeline/PhoenixHBaseAccessor.java [1996:2050]


  public List<TimelineMetricMetadata> scanMetricMetadataForWildCardRequest(Collection<String> metricNames,
                                                                           String appId,
                                                                           String instanceId) throws SQLException {
    List<TimelineMetricMetadata> metadataList = new ArrayList<>();
    Connection conn = getConnection();
    PreparedStatement stmt = null;
    ResultSet rs = null;

    MetadataQueryCondition metadataQueryCondition = new MetadataQueryCondition(new ArrayList<>(metricNames), appId, instanceId);
    stmt = PhoenixTransactSQL.prepareScanMetricMetadataSqlStmt(conn, metadataQueryCondition);
    try {
      if (stmt != null) {
        rs = stmt.executeQuery();
        while (rs.next()) {
          TimelineMetricMetadata metadata = new TimelineMetricMetadata(
            rs.getString("METRIC_NAME"),
            rs.getString("APP_ID"),
            rs.getString("INSTANCE_ID"),
            null,
            null,
            null,
            false,
            true
          );

          metadata.setUuid(checkForNull(rs.getBytes("UUID")));
          metadataList.add(metadata);
        }
      }
    } finally {
      if (rs != null) {
        try {
          rs.close();
        } catch (SQLException e) {
          // Ignore
        }
      }
      if (stmt != null) {
        try {
          stmt.close();
        } catch (SQLException e) {
          // Ignore
        }
      }
      if (conn != null) {
        try {
          conn.close();
        } catch (SQLException sql) {
          // Ignore
        }
      }
    }

    return metadataList;
  }