ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [2/3] ambari git commit: AMBARI-11841. Alerts received in single heartbeat should be processed in batch. Javadoc fix. (mpapirkovskyy)
Date Sat, 13 Jun 2015 16:00:31 GMT
AMBARI-11841. Alerts received in single heartbeat should be processed in batch. Javadoc fix.
(mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/65b6a893
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/65b6a893
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/65b6a893

Branch: refs/heads/trunk
Commit: 65b6a8931498eb52aecd1fca287262447fa127b7
Parents: 029e462
Author: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Authored: Sat Jun 13 18:57:52 2015 +0300
Committer: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Committed: Sat Jun 13 18:57:52 2015 +0300

----------------------------------------------------------------------
 .../apache/ambari/server/agent/HeartBeatHandler.java  |  5 +++++
 .../listeners/alerts/AlertReceivedListener.java       | 14 ++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/65b6a893/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index 029341c..1c993ef 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -310,6 +310,11 @@ public class HeartBeatHandler {
 
     if (null != heartbeat.getAlerts()) {
       AlertEvent event = new AlertReceivedEvent(heartbeat.getAlerts());
+      for (Alert alert : event.getAlerts()) {
+        if (alert.getHostName() == null) {
+          alert.setHostName(hostname);
+        }
+      }
       alertEventPublisher.publish(event);
 
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65b6a893/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
index 53b0cb5..0dd14cb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
@@ -250,6 +250,12 @@ public class AlertReceivedListener {
     }
   }
 
+  /**
+   * Saves alert and alert history entities in single transaction
+   * @param toCreate - new alerts, create alert and history
+   * @param toMerge - merge alert only
+   * @param toCreateHistoryAndMerge - create new history, merge alert
+   */
   @Transactional
   void saveEntities(Map<Alert, AlertCurrentEntity> toCreate, Map<Alert, AlertCurrentEntity>
toMerge,
                     Map<Alert, AlertCurrentEntity> toCreateHistoryAndMerge) {
@@ -269,10 +275,10 @@ public class AlertReceivedListener {
 
       if (LOG.isDebugEnabled()) {
         LOG.debug(
-          "Alert State Merged: CurrentId {}, CurrentTimestamp {}, HistoryId {}, HistoryState
{}",
-          entity.getAlertId(), entity.getLatestTimestamp(),
-          entity.getAlertHistory().getAlertId(),
-          entity.getAlertHistory().getAlertState());
+            "Alert State Merged: CurrentId {}, CurrentTimestamp {}, HistoryId {}, HistoryState
{}",
+            entity.getAlertId(), entity.getLatestTimestamp(),
+            entity.getAlertHistory().getAlertId(),
+            entity.getAlertHistory().getAlertState());
       }
     }
   }


Mime
View raw message