Interface SessionManager
- All Known Implementing Classes:
AbstractSessionManager
,DefaultSessionManager
public interface SessionManager
The session manager is responsible for session start, session exists, session write,
time to live and session destroy.
Created: 2017. 6. 12.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSessionListener
(SessionListener listener) Adds an event listener for session-related events.void
Removes all event listeners for session-related events.createSession
(String id) Create an entirely new Session.createSessionId
(long seedTerm) Create a new Session ID.int
int
getSession
(String id) Get a known existing session.void
invalidate
(String id) Called when a session has expired.void
invalidate
(String id, Session.DestroyedReason reason) void
recordSessionTime
(ManagedSession session) Record length of time session has been active.removeSession
(String id, boolean invalidate) Remove session from manager.removeSession
(String id, boolean invalidate, Session.DestroyedReason reason) void
removeSessionListener
(SessionListener listener) Removes an event listener for session-related events.renewSessionId
(String oldId, String newId) Change the id of a Session.void
setDefaultMaxIdleSecs
(int defaultMaxIdleSecs)
-
Method Details
-
getWorkerName
String getWorkerName() -
getScheduler
Scheduler getScheduler() -
getSessionIdGenerator
SessionIdGenerator getSessionIdGenerator() -
getSessionCache
SessionCache getSessionCache() -
getDefaultMaxIdleSecs
int getDefaultMaxIdleSecs() -
setDefaultMaxIdleSecs
void setDefaultMaxIdleSecs(int defaultMaxIdleSecs) -
getMaxIdleSecsForNew
int getMaxIdleSecsForNew() -
getSession
Get a known existing session.- Parameters:
id
- the session id- Returns:
- a Session or null if none exists
-
createSession
Create an entirely new Session.- Parameters:
id
- identity of session to create- Returns:
- the new session object
-
createSessionId
Create a new Session ID.- Parameters:
seedTerm
- the seed for RNG- Returns:
- the new session id
-
renewSessionId
Change the id of a Session.- Parameters:
oldId
- the current session idnewId
- the new session id- Returns:
- the Session after changing its id
-
removeSession
Remove session from manager.- Parameters:
id
- the session to removeinvalidate
- if false, only remove from cache- Returns:
- if the session was removed
-
removeSession
-
invalidate
Called when a session has expired.- Parameters:
id
- the id to invalidate
-
invalidate
-
addSessionListener
Adds an event listener for session-related events.- Parameters:
listener
- the session listener- See Also:
-
removeSessionListener
Removes an event listener for session-related events.- Parameters:
listener
- the session listener to remove- See Also:
-
clearSessionListeners
void clearSessionListeners()Removes all event listeners for session-related events.- See Also:
-
getActiveSessions
- Returns:
- the identifiers of those sessions that are active on this node, excluding passivated sessions
-
getAllSessions
- Returns:
- the identifiers of all sessions, including both active and passive
-
recordSessionTime
Record length of time session has been active. Called when the session is about to be invalidated.- Parameters:
session
- the session whose time to record
-
getStatistics
SessionStatistics getStatistics()
-