コード例 #1
0
 // called under "this" lock
 @Override
 public synchronized Alert getAlertByAlertUid(String alertUid) {
   for (AlertGroup alertGroup : alertGroupList) {
     for (Alert alert : alertGroup.alertsInGroupList) {
       if (alert.getAlertUid().equals(alertUid)) {
         return alert;
       }
     }
   }
   return null;
 }
コード例 #2
0
 // called under "this" lock
 private void mapAlertByGroupUid(Alert alert) {
   AlertGroup alertGroup = alertGroupByGroupUidMapping.get(alert.getGroupUid());
   boolean needsNewAlertGroup = (alertGroup != null && alertGroup.isResolved());
   if (alertGroup == null || needsNewAlertGroup) {
     alertGroup = new AlertGroup();
     alertGroup.addAlert(alert);
     alertGroupByGroupUidMapping.put(alert.getGroupUid(), alertGroup);
     alertGroupList.addFirst(alertGroup);
   } else {
     alertGroup.addAlert(alert);
     alertGroupList.remove(alertGroup);
     alertGroupList.addFirst(alertGroup);
   }
 }