예제 #1
0
파일: AlarmTask.java 프로젝트: qaulgj/cat
  private void processExceptionRule() {
    List<ThresholdRule> rules = m_manager.getAllExceptionRules();
    Transaction t = Cat.newTransaction("Alarm", "ProcessExceptionRule");

    for (ThresholdRule rule : rules) {
      try {
        String connectUrl = rule.getConnectUrl();
        ThresholdDataEntity entity = m_connector.fetchAlarmData(connectUrl);

        if (entity != null) {
          entity.setDomain(rule.getDomain());
          Cat.getProducer().logEvent("AlarmUrl", connectUrl, Event.SUCCESS, entity.toString());

          ExceptionDataEvent event = new ExceptionDataEvent(entity);

          m_dispatcher.dispatch(event);
        }
      } catch (Exception e) {
        t.setStatus(e);
        Cat.logError(e);
      }
    }
    t.setStatus(Transaction.SUCCESS);
    t.complete();
  }