public class DefaultSessionManager extends AbstractValidatingSessionManager implements CacheManagerAware
ValidatingSessionManager. All session CRUD operations are
delegated to an internal SessionDAO.| Modifier and Type | Field and Description |
|---|---|
protected SessionDAO |
sessionDAO |
DEFAULT_SESSION_VALIDATION_INTERVAL, sessionValidationInterval, sessionValidationScheduler, sessionValidationSchedulerEnabledDEFAULT_GLOBAL_SESSION_TIMEOUT, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND| Constructor and Description |
|---|
DefaultSessionManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterExpired(Session session) |
protected void |
afterStopped(Session session) |
protected void |
create(Session session)
Persists the given session instance to an underlying EIS (Enterprise Information System).
|
protected void |
delete(Session session) |
protected Session |
doCreateSession(SessionContext context) |
protected Collection<Session> |
getActiveSessions() |
SessionDAO |
getSessionDAO() |
SessionFactory |
getSessionFactory()
Returns the
SessionFactory used to generate new Session instances. |
protected Serializable |
getSessionId(SessionKey sessionKey) |
boolean |
isDeleteInvalidSessions()
Returns
true if sessions should be automatically deleted after they are discovered to be invalid,
false if invalid sessions will be manually deleted by some process external to Shiro's control. |
protected Session |
newSessionInstance(SessionContext context) |
protected void |
onChange(Session session) |
protected void |
onExpiration(Session session) |
protected void |
onStop(Session session) |
protected Session |
retrieveSession(SessionKey sessionKey)
Looks up a session from the underlying data store based on the specified session key.
|
protected Session |
retrieveSessionFromDataSource(Serializable sessionId) |
void |
setCacheManager(CacheManager cacheManager)
Sets the available CacheManager instance on this component.
|
void |
setDeleteInvalidSessions(boolean deleteInvalidSessions)
Sets whether or not sessions should be automatically deleted after they are discovered to be invalid.
|
void |
setSessionDAO(SessionDAO sessionDAO) |
void |
setSessionFactory(SessionFactory sessionFactory)
Sets the
SessionFactory used to generate new Session instances. |
afterSessionValidationEnabled, beforeSessionValidationDisabled, createSession, createSessionValidationScheduler, destroy, disableSessionValidation, doGetSession, doValidate, enableSessionValidation, getSessionValidationInterval, getSessionValidationScheduler, getTimeout, isSessionValidationSchedulerEnabled, onExpiration, onInvalidation, setSessionValidationInterval, setSessionValidationScheduler, setSessionValidationSchedulerEnabled, validate, validateSessionsapplyGlobalSessionTimeout, beforeInvalidNotification, checkValid, createExposedSession, createExposedSession, getAttribute, getAttributeKeys, getEventBus, getHost, getLastAccessTime, getSession, getSessionListeners, getStartTimestamp, getTimeout, isValid, notifyExpiration, notifyStart, notifyStop, onStart, onStop, publishEvent, removeAttribute, setAttribute, setEventBus, setSessionListeners, setTimeout, start, stop, touchgetGlobalSessionTimeout, setGlobalSessionTimeoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSession, startprotected SessionDAO sessionDAO
public void setSessionDAO(SessionDAO sessionDAO)
public SessionDAO getSessionDAO()
public SessionFactory getSessionFactory()
SessionFactory used to generate new Session instances. The default instance
is a SimpleSessionFactory.SessionFactory used to generate new Session instances.public void setSessionFactory(SessionFactory sessionFactory)
SessionFactory used to generate new Session instances. The default instance
is a SimpleSessionFactory.sessionFactory - the SessionFactory used to generate new Session instances.public boolean isDeleteInvalidSessions()
true if sessions should be automatically deleted after they are discovered to be invalid,
false if invalid sessions will be manually deleted by some process external to Shiro's control. The
default is true to ensure no orphans exist in the underlying data store.
false ONLY if you have some other process that you manage yourself
that periodically deletes invalid sessions from the backing data store over time, such as via a Quartz or Cron
job. If you do not do this, the invalid sessions will become 'orphans' and fill up the data store over time.
This property is provided because some systems need the ability to perform querying/reporting against sessions in
the data store, even after they have stopped or expired. Setting this attribute to false will allow
such querying, but with the caveat that the application developer/configurer deletes the sessions themselves by
some other means (cron, quartz, etc).true if sessions should be automatically deleted after they are discovered to be invalid,
false if invalid sessions will be manually deleted by some process external to Shiro's control.public void setDeleteInvalidSessions(boolean deleteInvalidSessions)
true to ensure no orphans will exist in the underlying data store.
false if you are manually going to delete sessions yourself by some process
(quartz, cron, etc) external to Shiro's control. See the
isDeleteInvalidSessions() JavaDoc for more.deleteInvalidSessions - whether or not sessions should be automatically deleted after they are discovered
to be invalid.public void setCacheManager(CacheManager cacheManager)
CacheManagerAwaresetCacheManager in interface CacheManagerAwarecacheManager - the CacheManager instance to set on this component.protected Session doCreateSession(SessionContext context)
doCreateSession in class AbstractValidatingSessionManagerprotected Session newSessionInstance(SessionContext context)
protected void create(Session session)
this.sessionDAO.create(session);session - the Session instance to persist to the underlying EIS.protected void onStop(Session session)
onStop in class AbstractNativeSessionManagerprotected void afterStopped(Session session)
afterStopped in class AbstractNativeSessionManagerprotected void onExpiration(Session session)
onExpiration in class AbstractValidatingSessionManagerprotected void afterExpired(Session session)
afterExpired in class AbstractValidatingSessionManagerprotected void onChange(Session session)
onChange in class AbstractNativeSessionManagerprotected Session retrieveSession(SessionKey sessionKey) throws UnknownSessionException
AbstractValidatingSessionManagerretrieveSession in class AbstractValidatingSessionManagersessionKey - the session key to use to look up the target session.sessionId.UnknownSessionException - if there is no session identified by sessionId.protected Serializable getSessionId(SessionKey sessionKey)
protected Session retrieveSessionFromDataSource(Serializable sessionId) throws UnknownSessionException
UnknownSessionExceptionprotected void delete(Session session)
protected Collection<Session> getActiveSessions()
getActiveSessions in class AbstractValidatingSessionManagerCopyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.