Exemplo n.º 1
0
  /**
   * 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);
  }