src/main/java/org/apache/hadoop/hdfs/server/namenode/analytics/MailOutput.java
public static void check(
      String emailConditionsStr,
      Map<String, Long> histogram,
      Set<String> highlightKeys,
      NameNodeLoader nameNodeLoader)
      throws IOException {
    QueryEngine queryEngine = nameNodeLoader.getQueryEngine();
    List<Function<Long, Boolean>> comparisons = queryEngine.createComparisons(emailConditionsStr);
    boolean shouldEmail = false;
    for (Map.Entry<String, Long> entry : histogram.entrySet()) {
      boolean columnCheck = queryEngine.check(comparisons, entry.getValue());
      if (columnCheck) {
        shouldEmail = true;
        highlightKeys.add(entry.getKey());
      }
    }
    if (!shouldEmail) {
      throw new IOException("Failed to meet requirements for email.");
    }
  }
/**
   * Check whether to send email histogram or not against specific criteria.
   *
   * @param emailConditionsStr the conditions for whether to email
   * @param histogram the histogram to compare against
   * @param highlightKeys the keys to highlight in the email
   * @param nameNodeLoader the NameNodeLoader
   * @throws IOException if email requirements are not met
   */
Check whether to send email histogram or not against specific criteria.
Check whether to send email histogram or not against specific criteria .
public static void check(
      String emailConditionsStr,
      Map<String, Long> histogram,
      Set<String> highlightKeys,
      NameNodeLoader nameNodeLoader)
      throws IOException {
    QueryEngine queryEngine = nameNodeLoader.getQueryEngine();
    List<Function<Long, Boolean>> comparisons = queryEngine.createComparisons(emailConditionsStr);
    boolean shouldEmail = false;
    for (Map.Entry<String, Long> entry : histogram.entrySet()) {
      boolean columnCheck = queryEngine.check(comparisons, entry.getValue());
      if (columnCheck) {
        shouldEmail = true;
        highlightKeys.add(entry.getKey());
      }
    }
    if (!shouldEmail) {
      throw new IOException("Failed to meet requirements for email.");
    }
  }
public static void check ( String emailConditionsStr , Map < String , Long > histogram , Set < String > highlightKeys , NameNodeLoader nameNodeLoader ) throws IOException { QueryEngine queryEngine = nameNodeLoader . getQueryEngine ( ) ; List < Function < Long , Boolean > > comparisons = queryEngine . createComparisons ( emailConditionsStr ) ; boolean shouldEmail = false ; for ( Map . Entry < String , Long > entry : histogram . entrySet ( ) ) { boolean columnCheck = queryEngine . check ( comparisons , entry . getValue ( ) ) ; if ( columnCheck ) { shouldEmail = true ; highlightKeys . add ( entry . getKey ( ) ) ; } } if ( ! shouldEmail ) { throw new IOException ( "Failed to meet requirements for email." ) ; } }
Check whether to send email histogram or not against specific criteria.
Check whether to send email histogram or not against specific criteria .