Exemplo n.º 1
0
    private void expireLoop() {
      while (enabled) {
        // Sleep
        try {
          synchronized (sleepLock) {
            sleepLock.wait(POLL_INTERVAL);
          }
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }

        if (!enabled) break;

        // Loop over conferences
        for (JitsiMeetConference conference :
            new ArrayList<JitsiMeetConference>(conferences.values())) {
          long idleStamp = conference.getIdleTimestamp();
          // Is active ?
          if (idleStamp == -1) {
            continue;
          }
          if (System.currentTimeMillis() - idleStamp > timeout) {
            logger.info("Focus idle timeout for " + conference.getRoomName());

            conference.stop();
          }
        }
      }
    }
Exemplo n.º 2
0
    void stop() {
      if (timeoutThread == null) {
        return;
      }

      enabled = false;

      synchronized (sleepLock) {
        sleepLock.notifyAll();
      }

      try {
        if (Thread.currentThread() != timeoutThread) {
          timeoutThread.join();
        }
        timeoutThread = null;
      } catch (InterruptedException e) {
        throw new RuntimeException(e);
      }
    }
Exemplo n.º 3
0
    void start() {
      if (timeoutThread != null) {
        throw new IllegalStateException();
      }

      timeoutThread =
          new Thread(
              new Runnable() {
                @Override
                public void run() {
                  expireLoop();
                }
              },
              "FocusExpireThread");

      enabled = true;

      timeoutThread.start();
    }