SessionManager, org.eclipse.jetty.util.component.LifeCyclepublic class HashSessionManager extends AbstractSessionManager
This manager supports saving sessions to disk, either periodically or at shutdown. Sessions can also have their content idle saved to disk to reduce the memory overheads of large idle sessions.
This manager will create it's own Timer instance to scavenge threads, unless it discovers a shared Timer instance set as the "org.eclipse.jetty.server.session.timer" attribute of the ContextHandler.
| Modifier and Type | Class | Description |
|---|---|---|
protected class |
HashSessionManager.Saver |
Saver
|
protected class |
HashSessionManager.Scavenger |
Scavenger
|
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerAbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIf| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.concurrent.ConcurrentMap<java.lang.String,HashedSession> |
_sessions |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING__defaultSessionTrackingModes, __distantFuture, _checkingRemoteSessionIdEncoding, _context, _dftMaxIdleSecs, _httpOnly, _loader, _maxCookieAge, _nodeIdInSessionId, _refreshCookieAge, _secureCookies, _secureRequestOnly, _sessionAttributeListeners, _sessionComment, _sessionCookie, _sessionDomain, _sessionHandler, _sessionIdListeners, _sessionIdManager, _sessionIdPathParameterName, _sessionIdPathParameterNamePrefix, _sessionListeners, _sessionPath, _sessionsStats, _sessionTimeStats, _sessionTrackingModes, MAX_INACTIVE_MINUTES__CheckRemoteSessionEncoding, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty| Constructor | Description |
|---|---|
HashSessionManager() |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
addSession(AbstractSession session) |
|
void |
doStart() |
|
void |
doStop() |
|
int |
getIdleSavePeriod() |
|
int |
getSavePeriod() |
|
int |
getScavengePeriod() |
|
AbstractSession |
getSession(java.lang.String idInCluster) |
Get a known existing session
|
int |
getSessions() |
|
java.io.File |
getStoreDirectory() |
|
boolean |
isDeleteUnrestorableSessions() |
|
boolean |
isLazyLoad() |
|
protected AbstractSession |
newSession(long created,
long accessed,
java.lang.String clusterId) |
|
protected AbstractSession |
newSession(javax.servlet.http.HttpServletRequest request) |
Create a new session instance
|
protected boolean |
removeSession(java.lang.String clusterId) |
|
void |
renewSessionId(java.lang.String oldClusterId,
java.lang.String oldNodeId,
java.lang.String newClusterId,
java.lang.String newNodeId) |
Tell the HttpSessionIdListeners the id changed.
|
HashedSession |
restoreSession(java.io.InputStream is,
HashedSession session) |
|
protected HashedSession |
restoreSession(java.lang.String idInCuster) |
|
void |
restoreSessions() |
|
void |
saveSessions(boolean reactivate) |
|
protected void |
scavenge() |
Find sessions that have timed out and invalidate them.
|
void |
setDeleteUnrestorableSessions(boolean deleteUnrestorableSessions) |
|
void |
setIdleSavePeriod(int seconds) |
Configures the period in seconds after which a session is deemed idle and saved
to save on session memory.
|
void |
setLazyLoad(boolean lazyLoad) |
|
void |
setMaxInactiveInterval(int seconds) |
Sets the max period of inactivity, after which the session is invalidated, in seconds.
|
void |
setSavePeriod(int seconds) |
|
void |
setScavengePeriod(int seconds) |
|
void |
setStoreDirectory(java.io.File dir) |
|
protected void |
shutdownSessions() |
Prepare sessions for session manager shutdown
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopaccess, addEventListener, addSession, clearEventListeners, complete, doSessionAttributeListeners, getClusterId, getContext, getContextHandler, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getMaxCookieAge, getMaxInactiveInterval, getMetaManager, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionCookieConfig, getSessionDomain, getSessionHandler, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionPath, getSessionsMax, getSessionsTotal, getSessionTimeMax, getSessionTimeMean, getSessionTimeStdDev, getSessionTimeTotal, isCheckingRemoteSessionIdEncoding, isNodeIdInSessionId, isSecureRequestOnly, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, removeSession, removeSession, setCheckingRemoteSessionIdEncoding, setHttpOnly, setNodeIdInSessionId, setRefreshCookieAge, setSecureRequestOnly, setSessionCookie, setSessionHandler, setSessionIdManager, setSessionIdPathParameterName, setSessionTrackingModes, setUsingCookies, statsResetaddBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansprotected final java.util.concurrent.ConcurrentMap<java.lang.String,HashedSession> _sessions
public void doStart()
throws java.lang.Exception
doStart in class AbstractSessionManagerjava.lang.ExceptionAbstractSessionManager.doStart()public void doStop()
throws java.lang.Exception
doStop in class AbstractSessionManagerjava.lang.ExceptionAbstractSessionManager.doStop()public int getScavengePeriod()
public int getSessions()
getSessions in class AbstractSessionManagerpublic int getIdleSavePeriod()
public void setIdleSavePeriod(int seconds)
seconds - Idle period after which a session is savedpublic void setMaxInactiveInterval(int seconds)
SessionManagersetMaxInactiveInterval in interface SessionManagersetMaxInactiveInterval in class AbstractSessionManagerseconds - the max inactivity period, in seconds.SessionManager.getMaxInactiveInterval()public void setSavePeriod(int seconds)
seconds - the period is seconds at which sessions are periodically saved to diskpublic int getSavePeriod()
public void setScavengePeriod(int seconds)
seconds - the period in seconds at which a check is made for sessions to be invalidated.protected void scavenge()
protected void addSession(AbstractSession session)
addSession in class AbstractSessionManagerpublic AbstractSession getSession(java.lang.String idInCluster)
AbstractSessionManagergetSession in class AbstractSessionManageridInCluster - The session ID in the cluster, stripped of any worker name.protected void shutdownSessions()
throws java.lang.Exception
AbstractSessionManagershutdownSessions in class AbstractSessionManagerjava.lang.Exception - if unable to shutdown sesssionspublic void renewSessionId(java.lang.String oldClusterId,
java.lang.String oldNodeId,
java.lang.String newClusterId,
java.lang.String newNodeId)
AbstractSessionManagerrenewSessionId in interface SessionManagerrenewSessionId in class AbstractSessionManageroldClusterId - the old cluster idoldNodeId - the old node idnewClusterId - the new cluster idnewNodeId - the new node idSessionManager.renewSessionId(java.lang.String, java.lang.String, java.lang.String, java.lang.String)protected AbstractSession newSession(javax.servlet.http.HttpServletRequest request)
AbstractSessionManagernewSession in class AbstractSessionManagerrequest - the request to build the session fromprotected AbstractSession newSession(long created, long accessed, java.lang.String clusterId)
protected boolean removeSession(java.lang.String clusterId)
removeSession in class AbstractSessionManagerpublic void setStoreDirectory(java.io.File dir)
throws java.io.IOException
java.io.IOExceptionpublic java.io.File getStoreDirectory()
public void setLazyLoad(boolean lazyLoad)
public boolean isLazyLoad()
public boolean isDeleteUnrestorableSessions()
public void setDeleteUnrestorableSessions(boolean deleteUnrestorableSessions)
public void restoreSessions()
throws java.lang.Exception
java.lang.Exceptionprotected HashedSession restoreSession(java.lang.String idInCuster)
public void saveSessions(boolean reactivate)
throws java.lang.Exception
java.lang.Exceptionpublic HashedSession restoreSession(java.io.InputStream is, HashedSession session) throws java.lang.Exception
java.lang.ExceptionCopyright © 1995–2018 Webtide. All rights reserved.