Esempio n. 1
0
    @Override
    public void run() {
      synchronized (RESTReservations.this) {
        Iterator<Conference> conferenceIterator = conferenceMap.values().iterator();

        while (conferenceIterator.hasNext()) {
          Conference conference = conferenceIterator.next();
          Date startTimeDate = conference.getStartTime();
          if (startTimeDate == null) {
            logger.error("No 'start_time' for conference: " + conference.getName());
            continue;
          }
          long startTime = startTimeDate.getTime();
          long duration = conference.getDuration();
          // Convert duration to millis
          duration = duration * 1000L;
          long now = System.currentTimeMillis();
          if (now - startTime > duration - EXPIRE_INTERVAL) {
            // Destroy the conference
            String mucRoomName = conference.getMucRoomName();

            deleteConference(conference.getId());

            conferenceIterator.remove();

            focusManager.destroyConference(mucRoomName, "Scheduled conference duration exceeded.");
          }
        }
      }
    }
Esempio n. 2
0
 /**
  * Finds conference for given ID assigned by the reservation system.
  *
  * @param id identifier of the conference to find.
  * @return <tt>Conference</tt> for given <tt>id</tt> or <tt>null</tt> if not found.
  */
 private Conference findConferenceForId(Number id) {
   for (Conference conference : conferenceMap.values()) {
     if (conference.getId().equals(id)) {
       return conference;
     }
   }
   return null;
 }
Esempio n. 3
0
  /** Deletes conference for given <tt>mucRoomName</tt> through the API. */
  Result deleteConference(String mucRoomName) {
    Conference conference = conferenceMap.get(mucRoomName);
    if (conference != null) {
      // Delete conference
      Number id = conference.getId();

      int result = deleteConference(id);

      if (result == RESULT_OK) {
        conferenceMap.remove(mucRoomName);
      } else {
        // Other error
        return new Result(result);
      }
    }
    return new Result(RESULT_OK);
  }