@TransactionAttribute(TransactionAttributeType.NEVER)
  public void calculateAutoBaselines() {
    Properties conf = systemManager.getSystemConfiguration(subjectManager.getOverlord());

    // frequency is how often the baselines are recalculated
    // data set is how far back for a particular scheduled measurement is included in the baseline
    // calcs
    // frequency of 3 days and data set of 10 days means "every 3 days, recalculate baselines
    // automatically.
    // For each scheduled measurement, take their last 10 days worth of data and use that data set
    // as the portion that will be used to get the min/max/average".
    String baselineFrequencyString = conf.getProperty(RHQConstants.BaselineFrequency);
    String baselineDataSetString = conf.getProperty(RHQConstants.BaselineDataSet);

    log.debug(
        "Found baseline defaults: "
            + "frequency="
            + baselineFrequencyString
            + " dataset="
            + baselineDataSetString);

    // Its time to auto-calculate the baselines again.
    // Determine how much data we need to calculate baselines for by determining the oldest and
    // youngest
    // measurement data to include in the calculations.
    long amountOfData = Long.parseLong(baselineDataSetString);
    long baselinesOlderThanTime =
        System.currentTimeMillis() - Long.parseLong(baselineFrequencyString);

    measurementBaselineManager.calculateAutoBaselines(amountOfData, baselinesOlderThanTime);

    // everything was calculated successfully, remember this time
    conf =
        systemManager.getSystemConfiguration(
            subjectManager
                .getOverlord()); // reload the config in case it was changed since we started
    try {
      systemManager.setSystemConfiguration(subjectManager.getOverlord(), conf, true);
    } catch (Exception e) {
      log.error(
          "Failed to remember the time when we just calc'ed baselines - it may recalculate again soon.",
          e);
    }
  }