/**
   * Remove from our <tt>jids</tt> map all entries that have not seen any activity (i.e. neither
   * outgoing nor incoming messags) for more than JID_INACTIVITY_TIMEOUT. Note that this method is
   * not synchronous and that it is only meant for use by the {@link #getThreadIDForAddress(String)}
   * and {@link #putJidForAddress(String, String)}
   */
  private void purgeOldJids() {
    long currentTime = System.currentTimeMillis();

    Iterator<Map.Entry<String, StoredThreadID>> entries = jids.entrySet().iterator();

    while (entries.hasNext()) {
      Map.Entry<String, StoredThreadID> entry = entries.next();
      StoredThreadID target = entry.getValue();

      if (currentTime - target.lastUpdatedTime > JID_INACTIVITY_TIMEOUT) entries.remove();
    }
  }
示例#2
0
  /**
   * Makes sure that conference is allocated for given <tt>room</tt>.
   *
   * @param room name of the MUC room of Jitsi Meet conference.
   * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid
   *     properties.
   * @throws Exception if any error occurs.
   */
  private void createConference(String room, Map<String, String> properties) throws Exception {
    JitsiMeetConfig config = new JitsiMeetConfig(properties);

    JitsiMeetConference conference =
        new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config);

    conferences.put(room, conference);

    StringBuilder options = new StringBuilder();
    for (Map.Entry<String, String> option : properties.entrySet()) {
      options.append("\n    ").append(option.getKey()).append(": ").append(option.getValue());
    }

    logger.info(
        "Created new focus for "
            + room
            + "@"
            + focusUserDomain
            + " conferences count: "
            + conferences.size()
            + " options:"
            + options.toString());

    // Send focus created event
    EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin();
    if (eventAdmin != null) {
      eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName()));
    }

    try {
      conference.start();
    } catch (Exception e) {
      logger.info("Exception while trying to start the conference", e);

      // stop() method is called by the conference automatically in order
      // to not release the lock on JitsiMeetConference instance and avoid
      // a deadlock. It may happen when this thread is about to call
      // conference.stop() and another thread has entered the method
      // before us. That other thread will try to call
      // FocusManager.conferenceEnded, but we're still holding the lock
      // on FocusManager instance.

      // conference.stop();

      throw e;
    }
  }
示例#3
0
  /**
   * Makes sure that conference is allocated for given <tt>room</tt>.
   *
   * @param room name of the MUC room of Jitsi Meet conference.
   * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid
   *     properties.
   * @throws Exception if any error occurs.
   */
  private void createConference(String room, Map<String, String> properties) throws Exception {
    JitsiMeetConfig config = new JitsiMeetConfig(properties);

    JitsiMeetConference conference =
        new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config);

    conferences.put(room, conference);

    StringBuilder options = new StringBuilder();
    for (Map.Entry<String, String> option : properties.entrySet()) {
      options.append("\n    ").append(option.getKey()).append(": ").append(option.getValue());
    }

    logger.info(
        "Created new focus for "
            + room
            + "@"
            + focusUserDomain
            + " conferences count: "
            + conferences.size()
            + " options:"
            + options.toString());

    // Send focus created event
    EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin();
    if (eventAdmin != null) {
      eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName()));
    }

    try {
      conference.start();
    } catch (Exception e) {
      logger.info("Exception while trying to start the conference", e);

      conference.stop();

      throw e;
    }
  }