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 voidaccess(Session session)Called by theSessionHandlerwhen a session is first accessed by a request.voidaddEventListener(java.util.EventListener listener)Adds an event listener for session-related events.voidclearEventListeners()Removes all event listeners for session-related events.voidcomplete(Session session)Called by theSessionHandlerwhen a session is last accessed by a request.voiddidActivate(Session session)Call the activation listeners.intgetDefaultMaxIdleSecs()SchedulergetScheduler()SessiongetSession(java.lang.String id)Get a known existing session.SessionCachegetSessionCache()SessionIdGeneratorgetSessionIdGenerator()intgetSessionsCreated()Returns the total number of sessions created by this manager.longgetSessionTimeMax()Returns the maximum time the session is valid.doublegetSessionTimeMean()Returns the mean amount of time session remained valid.doublegetSessionTimeStdDev()Returns the standard deviation of amount of time session remained valid.longgetSessionTimeTotal()Returns the total amount of time all sessions remained valid.voidinvalidate(java.lang.String id)Called when a session has expired.SessionnewSession(java.lang.String id)Creates a newSession.java.lang.StringnewSessionId(long seedTerm)voidremoveEventListener(java.util.EventListener listener)Removes an event listener for for session-related events.voidsessionAttributeChanged(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.voidsetDefaultMaxIdleSecs(int defaultMaxIdleSecs)voidstatsReset()Resets the session usage statistics.voidwillPassivate(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 theSessionHandlerwhen a session is first accessed by a request.- Parameters:
session- the session object- See Also:
complete(Session)
-
complete
void complete(Session session)
Called by theSessionHandlerwhen 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.
-
-