/**
   * Sets the time in milliseconds of the last activity related to this <tt>Conference</tt> to the
   * current system time.
   */
  public void touch() {
    long now = System.currentTimeMillis();

    synchronized (this) {
      if (getLastActivityTime() < now) lastActivityTime = now;
    }
  }
  /**
   * Saves the last status for all accounts. This information is used on loging. Each time user logs
   * in he's logged with the same status as he was the last time before closing the application.
   *
   * @param protocolProvider the protocol provider to save status information for
   * @param statusName the name of the status to save
   */
  private void saveStatusInformation(ProtocolProviderService protocolProvider, String statusName) {
    ConfigurationService configService = GuiActivator.getConfigurationService();

    String prefix = "net.java.sip.communicator.impl.gui.accounts";

    List<String> accounts = configService.getPropertyNamesByPrefix(prefix, true);

    boolean savedAccount = false;

    for (String accountRootPropName : accounts) {
      String accountUID = configService.getString(accountRootPropName);

      if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {

        configService.setProperty(accountRootPropName + ".lastAccountStatus", statusName);

        savedAccount = true;
      }
    }

    if (!savedAccount) {
      String accNodeName = "acc" + Long.toString(System.currentTimeMillis());

      String accountPackage = "net.java.sip.communicator.impl.gui.accounts." + accNodeName;

      configService.setProperty(
          accountPackage, protocolProvider.getAccountID().getAccountUniqueID());

      configService.setProperty(accountPackage + ".lastAccountStatus", statusName);
    }
  }
Example #3
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();
          }
        }
      }
    }