Ejemplo n.º 1
0
 public static List<Status> filterStatusListByTimeThreshold(List<Status> rawList, long threshold) {
   List<Status> filteredList = new ArrayList<Status>();
   for (Status s : rawList) {
     if (s.getDate() >= threshold) filteredList.add(s);
   }
   return filteredList;
 }
 /** Print status messages retrospectively */
 private void retrospectivePrint() {
   if (context == null) return;
   long now = System.currentTimeMillis();
   StatusManager sm = context.getStatusManager();
   List<Status> statusList = sm.getCopyOfStatusList();
   for (Status status : statusList) {
     long timestamp = status.getDate();
     if (now - timestamp < retrospective) {
       print(status);
     }
   }
 }
Ejemplo n.º 3
0
  /**
   * Return the time of last reset. -1 if last reset time could not be found
   *
   * @return time of last reset or -1
   */
  public long timeOfLastReset() {
    List<Status> statusList = sm.getCopyOfStatusList();
    if (statusList == null) return -1;

    int len = statusList.size();
    for (int i = len - 1; i >= 0; i--) {
      Status s = statusList.get(i);
      if (CoreConstants.RESET_MSG_PREFIX.equals(s.getMessage())) {
        return s.getDate();
      }
    }
    return -1;
  }