@Override
 public void sessionDestroyed(HttpSessionEvent _se) {
   try {
     HttpSession tempSession = sessions.remove(_se.getSession().getId());
   } catch (NullPointerException | UnsupportedOperationException | ClassCastException e) {
   }
   setUsersOnline(getUsersOnline() - 1);
 }
Esempio n. 2
0
  public static synchronized void sessionDestroyed(HttpSessionEvent ev) {
    HttpSession httpSession = ev.getSession();
    String id = httpSession.getId();

    synchronized (lookupSessionById) {
      lookupSessionById.remove(id);
    }

    // Forget HTTP-session:
    {
      lookupHttpSessionById.remove(id);
    }
  }
  @Override
  public void sessionCreated(HttpSessionEvent se) {
    HttpSession session = se.getSession();
    try {
      sessions.put(session.getId(), session);
      setUsersOnline(getUsersOnline() + 1);

    } catch (UnsupportedOperationException
        | ClassCastException
        | NullPointerException
        | IllegalArgumentException e) {
      System.out.println(
          "edu.temple.cis3238.wiki.WikiEventMonitor.sessionCreated() -- " + e.toString());
    }
  }
Esempio n. 4
0
  public static synchronized void sessionCreated(HttpSessionEvent ev) {
    HttpSession httpSession = ev.getSession();
    String id = httpSession.getId();

    // Remember HTTP-session:
    {
      lookupHttpSessionById.put(id, httpSession);
    }

    AbstractSession session = null;

    synchronized (lookupSessionById) {
      session = lookupSessionById.get(id);
    }

    if (session == null) {
      Principal userPrincipal = null;
      Date timeCreation = new Date(httpSession.getCreationTime());
      Date timeLastAccess = new Date(httpSession.getLastAccessedTime());
      List<String> urisForLastRequests = null;
      Properties properties = null;

      session =
          new DefaultSession(
              id, userPrincipal, timeCreation, timeLastAccess, urisForLastRequests, properties);

      synchronized (lookupSessionById) {
        lookupSessionById.put(id, session);

        // Update 'sessionCountMax':
        {
          int sessionCount = lookupSessionById.size();
          if (sessionCount > sessionCountMax) {
            sessionCountMax = sessionCount;
            sessionCountMaxTime = System.currentTimeMillis();
          }
        }
      }
    }
  }