Esempio n. 1
0
  public void buildBatchApiConfig(Payload payload, Model model) {
    Date start = TimeHelper.getCurrentDay(-1);
    Date end = TimeHelper.getCurrentDay();
    EventReport report = m_eventReportService.queryReport(Constants.BROKER_SERVICE, start, end);
    EventReportVisitor visitor = new EventReportVisitor();

    visitor.visitEventReport(report);
    Set<String> validatePaths = visitor.getPaths();
    Set<String> invalidatePaths = visitor.getInvalidatePaths();

    Map<String, Command> commands = m_appConfigManager.getCommands();

    for (Entry<String, Command> entry : commands.entrySet()) {
      validatePaths.remove(entry.getKey());
      invalidatePaths.remove(entry.getKey());
    }

    model.setValidatePaths(new ArrayList<String>(validatePaths));
    model.setInvalidatePaths(new ArrayList<String>(invalidatePaths));
  }
Esempio n. 2
0
  @Override
  public void run() {
    boolean active = true;
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      active = false;
    }
    while (active) {
      Transaction t = Cat.newTransaction("AlertDatabase", TimeHelper.getMinuteStr());
      long current = System.currentTimeMillis();

      try {
        Map<String, ProductLine> productLines =
            m_productLineConfigManager.getCompany().getProductLines();

        for (ProductLine productLine : productLines.values()) {
          try {
            if (productLine.isDatabaseMonitorDashboard()) {
              processProductLine(productLine);
            }
          } catch (Exception e) {
            Cat.logError(e);
          }
        }

        t.setStatus(Transaction.SUCCESS);
      } catch (Exception e) {
        t.setStatus(e);
      } finally {
        m_currentReports.clear();
        m_lastReports.clear();
        t.complete();
      }
      long duration = System.currentTimeMillis() - current;

      try {
        if (duration < DURATION) {
          Thread.sleep(DURATION - duration);
        }
      } catch (InterruptedException e) {
        active = false;
      }
    }
  }
Esempio n. 3
0
  @Override
  public void run() {
    boolean active = true;
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      active = false;
    }
    while (active) {
      Transaction t = Cat.newTransaction("AlertApp", TimeHelper.getMinuteStr());
      long current = System.currentTimeMillis();

      try {
        MonitorRules monitorRules = m_appRuleConfigManager.getMonitorRules();
        Map<String, Rule> rules = monitorRules.getRules();

        for (Entry<String, Rule> entry : rules.entrySet()) {
          try {
            processRule(entry.getValue());
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
        t.setStatus(Transaction.SUCCESS);
      } catch (Exception e) {
        t.setStatus(e);
        Cat.logError(e);
      } finally {
        t.complete();
      }
      long duration = System.currentTimeMillis() - current;

      try {
        if (duration < DURATION) {
          Thread.sleep(DURATION - duration);
        }
      } catch (InterruptedException e) {
        active = false;
      }
    }
  }