SessionManager, org.eclipse.jetty.util.component.LifeCyclepublic class JDBCSessionManager extends AbstractSessionManager
SessionManager that persists sessions to a database to enable clustering.
Session data is persisted to the JettySessions table:
| Modifier and Type | Class | Description |
|---|---|---|
class |
JDBCSessionManager.Session |
Session
Session instance.
|
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerAbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIf| Modifier and Type | Field | Description |
|---|---|---|
protected JDBCSessionIdManager |
_jdbcSessionIdMgr |
|
protected long |
_saveIntervalSec |
|
protected JDBCSessionIdManager.SessionTableSchema |
_sessionTableSchema |
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 |
|---|---|
JDBCSessionManager() |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
addSession(AbstractSession session) |
Add a newly created session to our in-memory list for this node and persist it.
|
void |
cacheInvalidate(JDBCSessionManager.Session session) |
A method that can be implemented in subclasses to support
distributed caching of sessions.
|
protected void |
deleteSession(JDBCSessionManager.Session data) |
Delete a session from the database.
|
void |
doStart() |
Start the session manager.
|
void |
doStop() |
Stop the session manager.
|
protected java.util.Set<java.lang.String> |
expire(java.util.Set<java.lang.String> sessionIds) |
Expire any Sessions we have in memory matching the list of
expired Session ids.
|
protected void |
expireCandidates(java.util.Set<java.lang.String> candidateIds) |
|
protected java.util.Set<java.lang.String> |
getCandidateExpiredIds() |
|
long |
getSaveInterval() |
|
JDBCSessionManager.Session |
getSession(java.lang.String idInCluster) |
A session has been requested by its id on this node.
|
int |
getSessions() |
Get the number of sessions.
|
protected void |
invalidateSession(java.lang.String idInCluster) |
Invalidate a session.
|
protected JDBCSessionManager.Session |
loadSession(java.lang.String id,
java.lang.String canonicalContextPath,
java.lang.String vhost) |
Load a session from the database
|
protected AbstractSession |
newSession(java.lang.String sessionId,
java.lang.String rowId,
long created,
long accessed,
long maxInterval) |
|
protected AbstractSession |
newSession(javax.servlet.http.HttpServletRequest request) |
Make a new Session.
|
protected boolean |
removeSession(java.lang.String idInCluster) |
Delete an existing session, both from the in-memory map and
the database.
|
boolean |
removeSession(AbstractSession session,
boolean invalidate) |
Remove session from manager
|
void |
renewSessionId(java.lang.String oldClusterId,
java.lang.String oldNodeId,
java.lang.String newClusterId,
java.lang.String newNodeId) |
Tell the HttpSessionIdListeners the id changed.
|
void |
setSaveInterval(long sec) |
Set the time in seconds which is the interval between
saving the session access time to the database.
|
protected void |
shutdownSessions() |
Prepare sessions for session manager shutdown
|
protected void |
storeSession(JDBCSessionManager.Session session) |
Insert a session into the database.
|
protected void |
updateSession(JDBCSessionManager.Session data) |
Update data on an existing persisted session.
|
protected void |
updateSessionNode(JDBCSessionManager.Session data) |
Update the node on which the session was last seen to be my node.
|
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, setCheckingRemoteSessionIdEncoding, setHttpOnly, setMaxInactiveInterval, 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 JDBCSessionIdManager _jdbcSessionIdMgr
protected long _saveIntervalSec
protected JDBCSessionIdManager.SessionTableSchema _sessionTableSchema
public void setSaveInterval(long sec)
sec - the save interval in secondspublic long getSaveInterval()
public void cacheInvalidate(JDBCSessionManager.Session session)
session - the session to invalidatepublic JDBCSessionManager.Session getSession(java.lang.String idInCluster)
getSession in class AbstractSessionManageridInCluster - The session ID in the cluster, stripped of any worker name.AbstractSessionManager.getSession(java.lang.String)public int getSessions()
getSessions in class AbstractSessionManagerAbstractSessionManager.getSessions()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()protected void shutdownSessions()
AbstractSessionManagershutdownSessions in class AbstractSessionManagerpublic 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 void invalidateSession(java.lang.String idInCluster)
idInCluster - the id in the clusterprotected boolean removeSession(java.lang.String idInCluster)
removeSession in class AbstractSessionManagerAbstractSessionManager.removeSession(java.lang.String)protected void addSession(AbstractSession session)
addSession in class AbstractSessionManagerAbstractSessionManager.addSession(org.eclipse.jetty.server.session.AbstractSession)protected AbstractSession newSession(javax.servlet.http.HttpServletRequest request)
newSession in class AbstractSessionManagerrequest - the request to build the session fromAbstractSessionManager.newSession(javax.servlet.http.HttpServletRequest)protected AbstractSession newSession(java.lang.String sessionId, java.lang.String rowId, long created, long accessed, long maxInterval)
public boolean removeSession(AbstractSession session, boolean invalidate)
removeSession in class AbstractSessionManagersession - The session to removeinvalidate - True if HttpSessionListener.sessionDestroyed(HttpSessionEvent) and
SessionIdManager.invalidateAll(String) should be called.protected java.util.Set<java.lang.String> expire(java.util.Set<java.lang.String> sessionIds)
sessionIds - the session ids to expireprotected void expireCandidates(java.util.Set<java.lang.String> candidateIds)
protected java.util.Set<java.lang.String> getCandidateExpiredIds()
protected JDBCSessionManager.Session loadSession(java.lang.String id, java.lang.String canonicalContextPath, java.lang.String vhost) throws java.lang.Exception
id - the idcanonicalContextPath - the canonical context pathvhost - the virtual hostjava.lang.Exception - if unable to load the sessionprotected void storeSession(JDBCSessionManager.Session session) throws java.lang.Exception
session - the sessionjava.lang.Exception - if unable to store the sessionprotected void updateSession(JDBCSessionManager.Session data) throws java.lang.Exception
data - the sessionjava.lang.Exception - if unable to update the sessionprotected void updateSessionNode(JDBCSessionManager.Session data) throws java.lang.Exception
data - the sessionjava.lang.Exception - if unable to update the session nodeprotected void deleteSession(JDBCSessionManager.Session data) throws java.lang.Exception
data - the session datajava.lang.Exception - if unable to delete the sessionCopyright © 1995–2018 Webtide. All rights reserved.