Ejemplo n.º 1
0
  public void execute() {
    log.info("Running custom analyzer for Stratos usage daily summarization.");
    try {
      String lastDailyTimestampStr =
          DataAccessObject.getInstance().getAndUpdateLastUsageDailyTimestamp();
      Long lastDailyTimestampSecs = Timestamp.valueOf(lastDailyTimestampStr).getTime() / 1000;

      DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
      String currentTsStr = formatter.format(new Date().getTime());
      Long currentTsSecs = Timestamp.valueOf(currentTsStr).getTime() / 1000;

      log.info(
          "Running daily usage analytics from " + lastDailyTimestampStr + " to " + currentTsStr);
      setProperty("last_daily_ts", lastDailyTimestampSecs.toString());
      setProperty("current_daily_ts", currentTsSecs.toString());
    } catch (Exception e) {
      log.error("An error occurred while setting date range for daily usage analysis. ", e);
    }
  }