Esempio n. 1
6
  protected void logoutAllSessions(boolean forceDisconnect) {
    log.info("Logging out all sessions");
    if (sessions == null) {
      log.error("Attempt to logout all sessions before initialization is complete.");
      return;
    }
    for (Session session : sessions.values()) {
      try {
        session.logout();
      } catch (Throwable e) {
        logError(session.getSessionID(), null, "Error during logout", e);
      }
    }

    if (forceDisconnect && isLoggedOn()) {
      for (Session session : sessions.values()) {
        try {
          if (session.isLoggedOn()) {
            session.disconnect("Forcibly disconnecting session", false);
          }
        } catch (Throwable e) {
          logError(session.getSessionID(), null, "Error during disconnect", e);
        }
      }
    }

    if (!forceDisconnect) {
      waitForLogout();
    }
  }
Esempio n. 2
0
 private Set<quickfix.Session> getLoggedOnSessions() {
   Set<quickfix.Session> loggedOnSessions = new HashSet<quickfix.Session>(sessions.size());
   for (Session session : sessions.values()) {
     if (session.isLoggedOn()) {
       loggedOnSessions.add(session);
     }
   }
   return loggedOnSessions;
 }
Esempio n. 3
0
 /**
  * Check if we have at least one session and that all the sessions are logged on
  *
  * @return false if no session or at least one session is not logged on
  */
 public boolean isLoggedOn() {
   // if no session, not logged on
   if (sessions.isEmpty()) return false;
   for (Session session : sessions.values()) {
     // at least one session not logged on
     if (!session.isLoggedOn()) return false;
   }
   // all the sessions are logged on
   return true;
 }
Esempio n. 4
0
 private void assertLoggedOn(ClientApplication clientApplication, Session clientSession)
     throws InterruptedException {
   assertNotNull("no client session", clientSession);
   clientApplication.logonLatch.await(20, TimeUnit.SECONDS);
   assertTrue("client session not logged in", clientSession.isLoggedOn());
 }