code: protected void parseAndSetPeriod(String attributeName) {
      String periodStr = getAttribute(attributeName);
      if (periodStr != null) {
        int period = 0;
        try {
          period = Integer.parseInt(periodStr);
        } catch (NumberFormatException nfe) {
        }
        if (period <= 0) {
          throw new MetricsException("Invalid period: " + periodStr);
        }
        setPeriod(period);
      }
    }
docs: If a period is set in the attribute passed in, override
  the default with it.