private void saveAlertToMemory(AlertInfoBO alert) {
   AlertPair value = alerts.getLast();
   if (value == null) {
     AlertPair pair = new AlertPair(alert, 0L);
     try {
       alerts.add(pair);
     } catch (FifoQueueException e) {
       e.printStackTrace();
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   } else {
     long maxId = value.getMaxId();
     long newMaxId = 0;
     if (maxId + 1 < Long.MAX_VALUE) newMaxId = maxId + 1;
     AlertPair pair = new AlertPair(alert, newMaxId);
     try {
       alerts.add(pair);
     } catch (FifoQueueException e) {
       e.printStackTrace();
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   }
 }