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.SessionIf
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.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, statsReset
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
protected final ConcurrentMap<String,HashedSession> _sessions
public void doStart() throws Exception
doStart
in class AbstractSessionManager
Exception
AbstractSessionManager
public void doStop() throws Exception
doStop
in class AbstractSessionManager
Exception
AbstractSessionManager
public int getScavengePeriod()
public int getSessions()
getSessions
in class AbstractSessionManager
public int getIdleSavePeriod()
public void setIdleSavePeriod(int seconds)
seconds
- Idle period after which a session is savedpublic void setMaxInactiveInterval(int seconds)
SessionManager
setMaxInactiveInterval
in interface SessionManager
setMaxInactiveInterval
in class AbstractSessionManager
seconds
- 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 AbstractSessionManager
public AbstractSession getSession(String idInCluster)
AbstractSessionManager
getSession
in class AbstractSessionManager
idInCluster
- The session ID in the cluster, stripped of any worker name.protected void invalidateSessions() throws Exception
invalidateSessions
in class AbstractSessionManager
Exception
protected AbstractSession newSession(javax.servlet.http.HttpServletRequest request)
AbstractSessionManager
newSession
in class AbstractSessionManager
protected AbstractSession newSession(long created, long accessed, String clusterId)
protected boolean removeSession(String clusterId)
removeSession
in class AbstractSessionManager
public void setStoreDirectory(File dir) throws IOException
IOException
public 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
Exception
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.