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.Saver
Saver
|
protected class |
HashSessionManager.Scavenger
Scavenger
|
AbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIf
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.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, _sessionIdListeners, _sessionIdManager, _sessionIdPathParameterName, _sessionIdPathParameterNamePrefix, _sessionListeners, _sessionPath, _sessionsStats, _sessionTimeStats, _sessionTrackingModes
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()
Starts the managed lifecycle beans in the order they were added.
|
void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
int |
getIdleSavePeriod() |
int |
getSavePeriod() |
int |
getScavengePeriod() |
AbstractSession |
getSession(String idInCluster)
Get a known existing session
|
int |
getSessions() |
File |
getStoreDirectory() |
boolean |
isDeleteUnrestorableSessions() |
boolean |
isLazyLoad() |
protected AbstractSession |
newSession(HttpServletRequest request)
Create a new session instance
|
protected AbstractSession |
newSession(long created,
long accessed,
String clusterId) |
protected boolean |
removeSession(String clusterId) |
void |
renewSessionId(String oldClusterId,
String oldNodeId,
String newClusterId,
String newNodeId)
Tell the HttpSessionIdListeners the id changed.
|
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) |
protected void |
shutdownSessions()
Prepare sessions for session manager shutdown
|
access, 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, statsReset
addBean, 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, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, 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
ContainerLifeCycle
doStart
in class AbstractSessionManager
Exception
AbstractSessionManager.doStart()
public void doStop() throws Exception
ContainerLifeCycle
doStop
in class AbstractSessionManager
Exception
AbstractSessionManager.doStop()
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 shutdownSessions() throws Exception
AbstractSessionManager
shutdownSessions
in class AbstractSessionManager
Exception
public void renewSessionId(String oldClusterId, String oldNodeId, String newClusterId, String newNodeId)
AbstractSessionManager
renewSessionId
in interface SessionManager
renewSessionId
in class AbstractSessionManager
SessionManager.renewSessionId(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
protected AbstractSession newSession(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-2015 Webtide. All Rights Reserved.