Class AbstractSessionHandler
- java.lang.Object
-
- com.aspectran.core.component.AbstractComponent
-
- com.aspectran.core.component.session.AbstractSessionHandler
-
- All Implemented Interfaces:
Component,SessionHandler
- Direct Known Subclasses:
DefaultSessionManager
public abstract class AbstractSessionHandler extends AbstractComponent implements SessionHandler
Abstract Implementation of SessionHandler.Created: 2017. 6. 12.
-
-
Field Summary
Fields Modifier and Type Field Description protected CounterStatisticsessionsCreatedStatsprotected SampleStatisticsessionTimeStats
-
Constructor Summary
Constructors Constructor Description AbstractSessionHandler()
-
Method Summary
All Methods Instance Methods Concrete 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.protected voiddoDestroy()protected voiddoInitialize()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)Create an entirely new Session.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)protected voidsetSessionCache(SessionCache sessionCache)protected voidsetSessionIdGenerator(SessionIdGenerator sessionIdGenerator)voidstatsReset()Resets the session usage statistics.voidwillPassivate(Session session)Call the passivation listeners.-
Methods inherited from class com.aspectran.core.component.AbstractComponent
destroy, getComponentName, initialize, isAvailable, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.aspectran.core.component.Component
destroy, getComponentName, initialize, isAvailable, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
sessionTimeStats
protected final SampleStatistic sessionTimeStats
-
sessionsCreatedStats
protected final CounterStatistic sessionsCreatedStats
-
-
Method Detail
-
getSessionIdGenerator
public SessionIdGenerator getSessionIdGenerator()
- Specified by:
getSessionIdGeneratorin interfaceSessionHandler
-
setSessionIdGenerator
protected void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator)
-
getSessionCache
public SessionCache getSessionCache()
- Specified by:
getSessionCachein interfaceSessionHandler
-
setSessionCache
protected void setSessionCache(SessionCache sessionCache)
-
getScheduler
public Scheduler getScheduler()
- Specified by:
getSchedulerin interfaceSessionHandler
-
getDefaultMaxIdleSecs
public int getDefaultMaxIdleSecs()
- Specified by:
getDefaultMaxIdleSecsin interfaceSessionHandler
-
setDefaultMaxIdleSecs
public void setDefaultMaxIdleSecs(int defaultMaxIdleSecs)
- Specified by:
setDefaultMaxIdleSecsin interfaceSessionHandler
-
access
public void access(Session session)
Called by theSessionHandlerwhen a session is first accessed by a request.- Specified by:
accessin interfaceSessionHandler- Parameters:
session- the session object- See Also:
complete(Session)
-
complete
public void complete(Session session)
Called by theSessionHandlerwhen a session is last accessed by a request.- Specified by:
completein interfaceSessionHandler- Parameters:
session- the session object- See Also:
access(Session)
-
newSession
public Session newSession(java.lang.String id)
Create an entirely new Session.- Specified by:
newSessionin interfaceSessionHandler- Parameters:
id- identity of session to create- Returns:
- the new session object
-
getSession
public Session getSession(java.lang.String id)
Description copied from interface:SessionHandlerGet a known existing session.- Specified by:
getSessionin interfaceSessionHandler- Parameters:
id- the session id- Returns:
- a Session or null if none exists
-
invalidate
public void invalidate(java.lang.String id)
Description copied from interface:SessionHandlerCalled when a session has expired.- Specified by:
invalidatein interfaceSessionHandler- Parameters:
id- the id to invalidate
-
newSessionId
public java.lang.String newSessionId(long seedTerm)
- Specified by:
newSessionIdin interfaceSessionHandler
-
addEventListener
public void addEventListener(java.util.EventListener listener)
Adds an event listener for session-related events.- Specified by:
addEventListenerin interfaceSessionHandler- Parameters:
listener- the session event listener- See Also:
removeEventListener(EventListener)
-
removeEventListener
public void removeEventListener(java.util.EventListener listener)
Removes an event listener for for session-related events.- Specified by:
removeEventListenerin interfaceSessionHandler- Parameters:
listener- the session event listener to remove- See Also:
addEventListener(EventListener)
-
clearEventListeners
public void clearEventListeners()
Removes all event listeners for session-related events.- Specified by:
clearEventListenersin interfaceSessionHandler- See Also:
removeEventListener(EventListener)
-
sessionAttributeChanged
public void sessionAttributeChanged(Session session, java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
Description copied from interface:SessionHandlerCall binding and attribute listeners based on the new and old values of the attribute.- Specified by:
sessionAttributeChangedin interfaceSessionHandler- Parameters:
session- the basic sessionname- name of the attributeoldValue- previous value of the attributenewValue- new value of the attribute
-
didActivate
public void didActivate(Session session)
Description copied from interface:SessionHandlerCall the activation listeners. This must be called holding the lock.- Specified by:
didActivatein interfaceSessionHandler- Parameters:
session- the session
-
willPassivate
public void willPassivate(Session session)
Description copied from interface:SessionHandlerCall the passivation listeners. This must be called holding the lock.- Specified by:
willPassivatein interfaceSessionHandler- Parameters:
session- the session
-
getSessionTimeMax
public long getSessionTimeMax()
Description copied from interface:SessionHandlerReturns the maximum time the session is valid.- Specified by:
getSessionTimeMaxin interfaceSessionHandler- Returns:
- the maximum amount of time session remained valid
-
getSessionTimeTotal
public long getSessionTimeTotal()
Description copied from interface:SessionHandlerReturns the total amount of time all sessions remained valid.- Specified by:
getSessionTimeTotalin interfaceSessionHandler- Returns:
- the total amount of time all sessions remained valid
-
getSessionTimeMean
public double getSessionTimeMean()
Description copied from interface:SessionHandlerReturns the mean amount of time session remained valid.- Specified by:
getSessionTimeMeanin interfaceSessionHandler- Returns:
- the mean amount of time session remained valid
-
getSessionTimeStdDev
public double getSessionTimeStdDev()
Description copied from interface:SessionHandlerReturns the standard deviation of amount of time session remained valid.- Specified by:
getSessionTimeStdDevin interfaceSessionHandler- Returns:
- the standard deviation of amount of time session remained valid
-
getSessionsCreated
public int getSessionsCreated()
Description copied from interface:SessionHandlerReturns the total number of sessions created by this manager.- Specified by:
getSessionsCreatedin interfaceSessionHandler- Returns:
- the total number of sessions created by this manager
-
statsReset
public void statsReset()
Resets the session usage statistics.- Specified by:
statsResetin interfaceSessionHandler
-
doInitialize
protected void doInitialize() throws java.lang.Exception- Specified by:
doInitializein classAbstractComponent- Throws:
java.lang.Exception
-
doDestroy
protected void doDestroy() throws java.lang.Exception- Specified by:
doDestroyin classAbstractComponent- Throws:
java.lang.Exception
-
-