public class JDBCSessionManager extends AbstractSessionManager
Modifier and Type | Class and Description |
---|---|
class |
JDBCSessionManager.Session
Session
Session instance.
|
AbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIf
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Modifier and Type | Field and Description |
---|---|
protected JDBCSessionIdManager |
_jdbcSessionIdMgr |
protected long |
_saveIntervalSec |
protected JDBCSessionIdManager.SessionTableSchema |
_sessionTableSchema |
__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 |
---|
JDBCSessionManager() |
Modifier and Type | Method and 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 Set<String> |
expire(Set<String> sessionIds)
Expire any Sessions we have in memory matching the list of
expired Session ids.
|
long |
getSaveInterval() |
JDBCSessionManager.Session |
getSession(String idInCluster)
A session has been requested by its id on this node.
|
int |
getSessions()
Get the number of sessions.
|
protected void |
invalidateSession(String idInCluster)
Invalidate a session.
|
protected JDBCSessionManager.Session |
loadSession(String id,
String canonicalContextPath,
String vhost)
Load a session from the database
|
protected AbstractSession |
newSession(HttpServletRequest request)
Make a new Session.
|
protected AbstractSession |
newSession(String sessionId,
String rowId,
long created,
long accessed,
long maxInterval) |
boolean |
removeSession(AbstractSession session,
boolean invalidate)
Remove session from manager
|
protected boolean |
removeSession(String idInCluster)
Delete an existing session, both from the in-memory map and
the database.
|
void |
renewSessionId(String oldClusterId,
String oldNodeId,
String newClusterId,
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.
|
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, setCheckingRemoteSessionIdEncoding, setHttpOnly, setMaxInactiveInterval, 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 JDBCSessionIdManager _jdbcSessionIdMgr
protected long _saveIntervalSec
protected JDBCSessionIdManager.SessionTableSchema _sessionTableSchema
public void setSaveInterval(long sec)
sec
- public long getSaveInterval()
public void cacheInvalidate(JDBCSessionManager.Session session)
session
- public JDBCSessionManager.Session getSession(String idInCluster)
getSession
in class AbstractSessionManager
idInCluster
- The session ID in the cluster, stripped of any worker name.AbstractSessionManager.getSession(java.lang.String)
public int getSessions()
getSessions
in class AbstractSessionManager
AbstractSessionManager.getSessions()
public void doStart() throws Exception
doStart
in class AbstractSessionManager
Exception
AbstractSessionManager.doStart()
public void doStop() throws Exception
doStop
in class AbstractSessionManager
Exception
AbstractSessionManager.doStop()
protected void shutdownSessions()
AbstractSessionManager
shutdownSessions
in class AbstractSessionManager
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 void invalidateSession(String idInCluster)
idInCluster
- protected boolean removeSession(String idInCluster)
removeSession
in class AbstractSessionManager
AbstractSessionManager.removeSession(java.lang.String)
protected void addSession(AbstractSession session)
addSession
in class AbstractSessionManager
AbstractSessionManager.addSession(org.eclipse.jetty.server.session.AbstractSession)
protected AbstractSession newSession(HttpServletRequest request)
newSession
in class AbstractSessionManager
AbstractSessionManager.newSession(javax.servlet.http.HttpServletRequest)
protected AbstractSession newSession(String sessionId, String rowId, long created, long accessed, long maxInterval)
sessionId
- rowId
- created
- accessed
- maxInterval
- public boolean removeSession(AbstractSession session, boolean invalidate)
removeSession
in class AbstractSessionManager
session
- The session to removeinvalidate
- True if HttpSessionListener#sessionDestroyed(HttpSessionEvent)
and
SessionIdManager#invalidateAll(String)
should be called.protected Set<String> expire(Set<String> sessionIds)
sessionIds
- protected JDBCSessionManager.Session loadSession(String id, String canonicalContextPath, String vhost) throws Exception
id
- Exception
protected void storeSession(JDBCSessionManager.Session session) throws Exception
session
- Exception
protected void updateSession(JDBCSessionManager.Session data) throws Exception
data
- the sessionException
protected void updateSessionNode(JDBCSessionManager.Session data) throws Exception
data
- the sessionException
protected void deleteSession(JDBCSessionManager.Session data) throws Exception
data
- Exception
Copyright © 1995-2015 Webtide. All Rights Reserved.