@Override
  public void editSchedule() {
    // grab all changed metrics and update bindings
    collector.clear();
    queueMetrics.getMetrics(collector, false);
    jvmMetrics.getMetrics(collector, false);

    for (MetricsRecord record : collector.getRecords()) {
      for (AbstractMetric am : record.metrics()) {
        bindings.put(am.name().replace(' ', '_'), am.value());
      }
    }

    // evaluate all invariants with new bindings
    try {

      // fastpath check all invariants at once (much faster)
      boolean allInvHold = (boolean) combinedInvariants.eval(bindings);

      // if any fails, check individually to produce more insightful log
      if (!allInvHold) {
        for (Map.Entry<String, CompiledScript> e : invariants.entrySet()) {
          boolean invariantsHold = (boolean) e.getValue().eval(bindings);
          if (!invariantsHold) {
            // filter bindings to produce minimal set
            Map<String, Object> matchingBindings =
                extractMatchingBindings(e.getKey(), bindings);
            logOrThrow("Invariant \"" + e.getKey()
                + "\" is NOT holding, with bindings: " + matchingBindings);
          }
        }
      }
    } catch (ScriptException e) {
      logOrThrow(e.getMessage());
    }
  }
@Test(timeout = 5000)
  public void testManyRuns() {

    QueueMetrics qm =
        QueueMetrics.forQueue(metricsSystem, "root", null, false, conf);
    qm.setAvailableResourcesToQueue(RMNodeLabelsManager.NO_LABEL,
        Resource.newInstance(1, 1));

    int numIterations = 1000;
    long start = System.currentTimeMillis();
    for (int i = 0; i < numIterations; i++) {
      ic.editSchedule();
    }
    long end = System.currentTimeMillis();

    System.out.println("Runtime per iteration (avg of " + numIterations
        + " iterations): " + (end - start) + " tot time");

  }