Interface SessionHandler
-
- All Superinterfaces:
Component
- All Known Implementing Classes:
AbstractSessionHandler
,DefaultSessionManager
public interface SessionHandler extends Component
The session handler is responsible for session start, session exists, session write, time to live and session destroy.Created: 2017. 6. 12.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
access(Session session)
Called by theSessionHandler
when a session is first accessed by a request.void
addEventListener(java.util.EventListener listener)
Adds an event listener for session-related events.void
clearEventListeners()
Removes all event listeners for session-related events.void
complete(Session session)
Called by theSessionHandler
when a session is last accessed by a request.void
didActivate(Session session)
Call the activation listeners.int
getDefaultMaxIdleSecs()
Scheduler
getScheduler()
Session
getSession(java.lang.String id)
Get a known existing session.SessionCache
getSessionCache()
SessionIdGenerator
getSessionIdGenerator()
int
getSessionsCreated()
Returns the total number of sessions created by this manager.long
getSessionTimeMax()
Returns the maximum time the session is valid.double
getSessionTimeMean()
Returns the mean amount of time session remained valid.double
getSessionTimeStdDev()
Returns the standard deviation of amount of time session remained valid.long
getSessionTimeTotal()
Returns the total amount of time all sessions remained valid.void
invalidate(java.lang.String id)
Called when a session has expired.Session
newSession(java.lang.String id)
Creates a newSession
.java.lang.String
newSessionId(long seedTerm)
void
removeEventListener(java.util.EventListener listener)
Removes an event listener for for session-related events.void
sessionAttributeChanged(Session session, java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
Call binding and attribute listeners based on the new and old values of the attribute.void
setDefaultMaxIdleSecs(int defaultMaxIdleSecs)
void
statsReset()
Resets the session usage statistics.void
willPassivate(Session session)
Call the passivation listeners.-
Methods inherited from interface com.aspectran.core.component.Component
destroy, getComponentName, initialize, isAvailable, isDestroyed, isInitialized
-
-
-
-
Method Detail
-
getSessionIdGenerator
SessionIdGenerator getSessionIdGenerator()
-
getSessionCache
SessionCache getSessionCache()
-
getScheduler
Scheduler getScheduler()
-
getDefaultMaxIdleSecs
int getDefaultMaxIdleSecs()
-
setDefaultMaxIdleSecs
void setDefaultMaxIdleSecs(int defaultMaxIdleSecs)
-
access
void access(Session session)
Called by theSessionHandler
when a session is first accessed by a request.- Parameters:
session
- the session object- See Also:
complete(Session)
-
complete
void complete(Session session)
Called by theSessionHandler
when a session is last accessed by a request.- Parameters:
session
- the session object- See Also:
access(Session)
-
newSession
Session newSession(java.lang.String id)
Creates a newSession
.- Parameters:
id
- the session id- Returns:
- the new session object
-
getSession
Session getSession(java.lang.String id)
Get a known existing session.- Parameters:
id
- the session id- Returns:
- a Session or null if none exists
-
invalidate
void invalidate(java.lang.String id)
Called when a session has expired.- Parameters:
id
- the id to invalidate
-
newSessionId
java.lang.String newSessionId(long seedTerm)
-
addEventListener
void addEventListener(java.util.EventListener listener)
Adds an event listener for session-related events.- Parameters:
listener
- the session event listener- See Also:
removeEventListener(EventListener)
-
removeEventListener
void removeEventListener(java.util.EventListener listener)
Removes an event listener for for session-related events.- Parameters:
listener
- the session event listener to remove- See Also:
addEventListener(EventListener)
-
clearEventListeners
void clearEventListeners()
Removes all event listeners for session-related events.- See Also:
removeEventListener(EventListener)
-
sessionAttributeChanged
void sessionAttributeChanged(Session session, java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
Call binding and attribute listeners based on the new and old values of the attribute.- Parameters:
session
- the basic sessionname
- name of the attributeoldValue
- previous value of the attributenewValue
- new value of the attribute
-
didActivate
void didActivate(Session session)
Call the activation listeners. This must be called holding the lock.- Parameters:
session
- the session
-
willPassivate
void willPassivate(Session session)
Call the passivation listeners. This must be called holding the lock.- Parameters:
session
- the session
-
getSessionTimeMax
long getSessionTimeMax()
Returns the maximum time the session is valid.- Returns:
- the maximum amount of time session remained valid
-
getSessionTimeTotal
long getSessionTimeTotal()
Returns the total amount of time all sessions remained valid.- Returns:
- the total amount of time all sessions remained valid
-
getSessionTimeMean
double getSessionTimeMean()
Returns the mean amount of time session remained valid.- Returns:
- the mean amount of time session remained valid
-
getSessionTimeStdDev
double getSessionTimeStdDev()
Returns the standard deviation of amount of time session remained valid.- Returns:
- the standard deviation of amount of time session remained valid
-
getSessionsCreated
int getSessionsCreated()
Returns the total number of sessions created by this manager.- Returns:
- the total number of sessions created by this manager
-
statsReset
void statsReset()
Resets the session usage statistics.
-
-