Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.SessionArrayValue


   * Creates a session.  It's already been established that the
   * key does not currently have a session.
   */
  protected SessionArrayValue create(Env env, String key, long now)
  {
    SessionArrayValue session
      = createSessionValue(key, now, _sessionTimeout);

    load(env, session, now);

    // If another thread has created and stored a new session,
    // putIfNew will return the old session
    session = _sessions.putIfNew(key, session);

    if (! key.equals(session.getId()))
      throw new IllegalStateException(key + " != " + session.getId());

    return (SessionArrayValue)session.copy(env);
  }
View Full Code Here


   * Creates a new SessionArrayValue instance.
   */
  protected SessionArrayValue createSessionValue(String key, long now,
                                                 long sessionTimeout)
  {
    return new SessionArrayValue(key, now, _sessionTimeout);
  }
View Full Code Here

      synchronized (_sessions) {
        _sessionIter = _sessions.values(_sessionIter);

        while (_sessionIter.hasNext()) {
          SessionArrayValue session = _sessionIter.next();

          long maxIdleTime = session.getMaxInactiveInterval();

          if (session.inUse())
            liveSessions++;
          else if (session.getAccessTime() + maxIdleTime < now)
            _sessionList.add(session);
          else
            liveSessions++;
        }
      }

      synchronized (_statisticsLock) {
        _sessionTimeoutCount += _sessionList.size();
      }

      for (int i = 0; i < _sessionList.size(); i++) {
        SessionArrayValue session = _sessionList.get(i);

        try {
          long maxIdleTime = session.getMaxInactiveInterval();
          _sessions.remove(session.getId());

          session.invalidate();
        } catch (Throwable e) {
          log.log(Level.FINER, e.toString(), e);
        }
      }
    } finally {
View Full Code Here

    synchronized (_sessions) {
      _sessionIter = _sessions.values(_sessionIter);

      while (_sessionIter.hasNext()) {
        SessionArrayValue session = _sessionIter.next();

        if (session.isValid())
          list.add(session);
      }
    }

    for (int i = list.size() - 1; i >= 0; i--) {
      SessionArrayValue session = list.get(i);

      try {
        if (session.isValid()) {
          synchronized (session) {
            if (! session.isEmpty())
              session.storeOnShutdown();
          }
        }

        _sessions.remove(session.getId());
      } catch (Exception e) {
        if (! isError)
          log.log(Level.WARNING, "Can't store session: " + e, e);
        isError = true;
      }
View Full Code Here

  /**
   * Notification from the cluster.
   */
  public void notifyRemove(String id)
  {
    SessionArrayValue session = _sessions.remove(id);

    if (session != null)
      session.invalidate();
  }
View Full Code Here

   * Saves the session.
   */
  public void store(OutputStream out, Object obj)
    throws IOException
  {
    SessionArrayValue session = (SessionArrayValue) obj;

    session.store(Env.getInstance(), out);
  }
View Full Code Here

TOP

Related Classes of com.caucho.quercus.env.SessionArrayValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.