public class InMemorySessionDataAccess extends java.lang.Object implements SessionDataAccess
SessionDataAccess implementation that uses PackedMap to map user ID to session ID, session ID to
user ID and session ID to session expiration.
Sessions aren't automatically removed when expired.
| Constructor and Description |
|---|
InMemorySessionDataAccess() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSession(Session session)
Adds a new session.
|
Session |
getSessionByID(java.lang.String sessionID)
Retrieves the active session with given session ID.
|
Session |
getSessionByUser(java.lang.String userID)
Retrieves the active session of the given user.
|
void |
refreshSession(java.lang.String sessionID,
long newExpiration)
Refreshes the expiration date of the session.
|
void |
removeSession(Session session)
Removes a session.
|
public void addSession(Session session)
SessionDataAccessaddSession in interface SessionDataAccesssession - the new Session.public Session getSessionByUser(java.lang.String userID)
SessionDataAccessgetSessionByUser in interface SessionDataAccessuserID - the identifier of the user.null if none matching the user.public Session getSessionByID(java.lang.String sessionID)
SessionDataAccessgetSessionByID in interface SessionDataAccesssessionID - the identifier of the session.null if none with that ID.public void refreshSession(java.lang.String sessionID,
long newExpiration)
SessionDataAccessrefreshSession in interface SessionDataAccesssessionID - the ID of the session to refresh.newExpiration - the new expiration date.public void removeSession(Session session)
SessionDataAccessremoveSession in interface SessionDataAccesssession - the Session to remove.