コード例 #1
0
  // -------------------------------------------------------------------------
  public void verifyRemoteHost(
      String hostname, String dialbackValue, String id, IMServerSession session) throws Exception {
    S2SConnector s2s = getS2SConnector(hostname);

    s2s.sendVerify(dialbackValue, id);

    if (!s2s.getSession().getDialbackValid()) {
      s2s.sendResult();
    }

    session.setTwinSession(s2s.getSession());
    s2s.getSession().setTwinSession(session);
  }
コード例 #2
0
  // ----------------------------------------------------------------------
  public IMServerSession getRemoteSessionWaitForValidation(String hostname, long timeout)
      throws Exception {
    IMServerSession session = null;
    S2SConnector s2s = null;

    synchronized (hostnameAndS2SMap) {
      s2s = (S2SConnector) hostnameAndS2SMap.get(hostname);

      if (s2s != null && !s2s.getSession().isClosed()) {
        session = s2s.getSession();
      } else {
        s2s = getS2SConnector(hostname);
        session = s2s.getSession();
      }
    }

    synchronized (session) {
      // wait for validation
      if (!session.getDialbackValid()) {
        s2s.sendResult();
        defaultNeximLogger.info("Wait validation for " + hostname + " for session " + session);
        session.wait(timeout);
      }
    }

    if (!session.getDialbackValid()) {
      throw new Exception(
          "Unable to get dialback validation for "
              + hostname
              + " after timeout "
              + timeout
              + " ms");
    }

    defaultNeximLogger.info("Validation granted from " + hostname + " for session " + session);

    return session;
  } // getremote session