public 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 and Description |
|---|---|
protected class |
HashSessionManager.ClassLoadingObjectInputStream |
AbstractSessionManager.SessionIfAbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<String,HashedSession> |
_sessions |
__defaultSessionTrackingModes, __distantFuture, _checkingRemoteSessionIdEncoding, _context, _dftMaxIdleSecs, _httpOnly, _loader, _maxCookieAge, _nodeIdInSessionId, _refreshCookieAge, _secureCookies, _secureRequestOnly, _sessionAttributeListeners, _sessionComment, _sessionCookie, _sessionDomain, _sessionHandler, _sessionIdManager, _sessionIdPathParameterName, _sessionIdPathParameterNamePrefix, _sessionListeners, _sessionPath, _sessionsStats, _sessionTimeStats, _sessionTrackingModes, SESSION_KNOWN_ONLY_TO_AUTHENTICATED_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING__CheckRemoteSessionEncoding, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty| Constructor and Description |
|---|
HashSessionManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addSession(AbstractSession session) |
void |
doStart() |
void |
doStop() |
int |
getIdleSavePeriod() |
int |
getSavePeriod() |
int |
getScavengePeriod() |
AbstractSession |
getSession(String idInCluster)
Get a known existing session
|
int |
getSessions() |
File |
getStoreDirectory() |
protected void |
invalidateSessions() |
boolean |
isDeleteUnrestorableSessions() |
boolean |
isLazyLoad() |
protected AbstractSession |
newSession(javax.servlet.http.HttpServletRequest request)
Create a new session instance
|
protected AbstractSession |
newSession(long created,
long accessed,
String clusterId) |
protected boolean |
removeSession(String clusterId) |
HashedSession |
restoreSession(InputStream is,
HashedSession session) |
protected HashedSession |
restoreSession(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(File dir) |
access, addEventListener, addSession, clearEventListeners, complete, doSessionAttributeListeners, getClusterId, getContext, getContextHandler, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getIdManager, getMaxCookieAge, getMaxInactiveInterval, getMaxSessions, getMetaManager, getMinSessions, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionCookieConfig, getSessionDomain, getSessionHandler, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionMap, getSessionPath, getSessionsMax, getSessionsTotal, getSessionTimeMax, getSessionTimeMean, getSessionTimeStdDev, getSessionTimeTotal, isCheckingRemoteSessionIdEncoding, isNodeIdInSessionId, isSecureRequestOnly, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, removeSession, removeSession, renewSession, resetStats, setCheckingRemoteSessionIdEncoding, setHttpOnly, setIdManager, setNodeIdInSessionId, setRefreshCookieAge, setSecureRequestOnly, setSessionCookie, setSessionHandler, setSessionIdManager, setSessionIdPathParameterName, setSessionTrackingModes, setUsingCookies, statsResetaddLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopprotected final ConcurrentMap<String,HashedSession> _sessions
public void doStart()
throws Exception
doStart in class AbstractSessionManagerExceptionAbstractSessionManagerpublic void doStop()
throws Exception
doStop in class AbstractSessionManagerExceptionAbstractSessionManagerpublic 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(String idInCluster)
AbstractSessionManagergetSession in class AbstractSessionManageridInCluster - The session ID in the cluster, stripped of any worker name.protected void invalidateSessions()
throws Exception
invalidateSessions in class AbstractSessionManagerExceptionprotected AbstractSession newSession(javax.servlet.http.HttpServletRequest request)
AbstractSessionManagernewSession in class AbstractSessionManagerprotected AbstractSession newSession(long created, long accessed, String clusterId)
protected boolean removeSession(String clusterId)
removeSession in class AbstractSessionManagerpublic void setStoreDirectory(File dir) throws IOException
IOExceptionpublic File getStoreDirectory()
public void setLazyLoad(boolean lazyLoad)
public boolean isLazyLoad()
public boolean isDeleteUnrestorableSessions()
public void setDeleteUnrestorableSessions(boolean deleteUnrestorableSessions)
protected HashedSession restoreSession(String idInCuster)
public HashedSession restoreSession(InputStream is, HashedSession session) throws Exception
ExceptionCopyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.