SessionManager
, Container
, Destroyable
, Dumpable
, LifeCycle
@ManagedObject("Mongo Session Manager") public class MongoSessionManager extends NoSqlSessionManager
Clustered session manager using MongoDB as the shared DB instance. The document model is an outer object that contains the elements:
One of the name:value attribute pairs will always be the special attribute "__metadata__". The value is an object representing a version counter which is incremented every time the attributes change.
For example:
{ "_id" : ObjectId("52845534a40b66410f228f23"), "accessed" : NumberLong("1384818548903"), "maxIdle" : 1, "created" : NumberLong("1384818548903"), "expiry" : NumberLong("1384818549903"), "id" : "w01ijx2vnalgv1sqrpjwuirprp7", "valid" : true "context" : { "::/contextA" : { "A" : "A", "__metadata__" : { "version" : NumberLong(2) } }, "::/contextB" : { "B" : "B", "__metadata__" : { "version" : NumberLong(1) } } } }
In MongoDB, the nesting level is indicated by "." separators for the key name. Thus to
interact with a session attribute, the key is composed of:
"context".unique_context_name.attribute_name
Eg "context"."::/contextA"."A"
Modifier and Type | Class | Description |
---|---|---|
protected class |
MongoSessionManager.ClassLoadingObjectInputStream |
ClassLoadingObjectInputStream
|
AbstractLifeCycle.AbstractLifeCycleListener
AbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIf
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
__ACCESSED |
Last access time of session
|
static java.lang.String |
__EXPIRY |
Time this session will expire, based on last access time and maxIdle
|
static java.lang.String |
__ID |
Session id
|
static java.lang.String |
__INVALIDATED |
Time at which session was invalidated
|
static java.lang.String |
__MAX_IDLE |
The max idle time of a session (smallest value across all contexts which has a session with the same id)
|
static java.lang.String |
__VALID |
Whether or not session is valid
|
static java.lang.String |
__VERSION |
Special attribute per session per context, incremented each time attributes are modified
|
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
_sessions
__CheckRemoteSessionEncoding, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty
Constructor | Description |
---|---|
MongoSessionManager() |
Modifier and Type | Method | Description |
---|---|---|
protected java.lang.String |
decodeName(java.lang.String name) |
|
protected java.lang.Object |
decodeValue(java.lang.Object valueToDecode) |
|
void |
doStart() |
|
protected java.lang.Object |
encodeName(java.lang.Object value) |
|
protected java.lang.String |
encodeName(java.lang.String name) |
|
protected void |
expire(java.lang.String idInCluster) |
|
long |
getSessionStoreCount() |
returns the total number of session objects in the session store
the count() operation itself is optimized to perform on the server side
and avoid loading to client side.
|
protected void |
idle() |
Passivate out any sessions that are not expired, but have been idle
longer than the idle timeout
|
protected NoSqlSession |
loadSession(java.lang.String clusterId) |
|
void |
purge() |
|
void |
purgeFully() |
|
protected java.lang.Object |
refresh(NoSqlSession session,
java.lang.Object version) |
|
protected boolean |
remove(NoSqlSession session) |
Remove the per-context sub document for this session id.
|
protected java.lang.Object |
save(NoSqlSession session,
java.lang.Object version,
boolean activateAfterSave) |
|
void |
scavenge() |
|
void |
scavengeFully() |
|
void |
setSessionIdManager(SessionIdManager metaManager) |
|
protected void |
update(NoSqlSession session,
java.lang.String newClusterId,
java.lang.String newNodeId) |
Change the session id.
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
access, addEventListener, addSession, clearEventListeners, complete, doSessionAttributeListeners, doStop, getClusterId, getContext, getContextHandler, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getMaxCookieAge, getMaxInactiveInterval, getMetaManager, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionCookieConfig, getSessionDomain, getSessionHandler, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionPath, getSessions, getSessionsMax, getSessionsTotal, getSessionTimeMax, getSessionTimeMean, getSessionTimeStdDev, getSessionTimeTotal, isCheckingRemoteSessionIdEncoding, isNodeIdInSessionId, isSecureRequestOnly, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, removeSession, removeSession, setCheckingRemoteSessionIdEncoding, setHttpOnly, setMaxInactiveInterval, setNodeIdInSessionId, setRefreshCookieAge, setSecureRequestOnly, setSessionCookie, setSessionHandler, 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, updateBean, updateBeans
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
addSession, getIdlePeriod, getSavePeriod, getSession, getStalePeriod, invalidateSession, isDeidleBeforeExpiry, isInvalidateOnStop, isPreserveOnStop, isSaveAllAttributes, newSession, removeSession, renewSessionId, setDeidleBeforeExpiry, setIdlePeriod, setInvalidateOnStop, setPreserveOnStop, setSaveAllAttributes, setSavePeriod, setStalePeriod, shutdownSessions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
access, addEventListener, clearEventListeners, complete, getClusterId, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getMaxInactiveInterval, getMetaManager, getNodeId, getSessionCookie, getSessionCookieConfig, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, isCheckingRemoteSessionIdEncoding, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, setCheckingRemoteSessionIdEncoding, setMaxInactiveInterval, setSessionHandler, setSessionIdPathParameterName, setSessionTrackingModes
public static final java.lang.String __ID
public static final java.lang.String __VALID
public static final java.lang.String __INVALIDATED
public static final java.lang.String __ACCESSED
public static final java.lang.String __EXPIRY
public static final java.lang.String __MAX_IDLE
public static final java.lang.String __VERSION
public MongoSessionManager() throws java.net.UnknownHostException, com.mongodb.MongoException
java.net.UnknownHostException
com.mongodb.MongoException
public void doStart() throws java.lang.Exception
doStart
in class NoSqlSessionManager
java.lang.Exception
AbstractSessionManager.doStart()
public void setSessionIdManager(SessionIdManager metaManager)
setSessionIdManager
in interface SessionManager
setSessionIdManager
in class AbstractSessionManager
AbstractSessionManager.setSessionIdManager(org.eclipse.jetty.server.SessionIdManager)
protected java.lang.Object save(NoSqlSession session, java.lang.Object version, boolean activateAfterSave)
save
in class NoSqlSessionManager
protected java.lang.Object refresh(NoSqlSession session, java.lang.Object version)
refresh
in class NoSqlSessionManager
protected NoSqlSession loadSession(java.lang.String clusterId)
loadSession
in class NoSqlSessionManager
protected boolean remove(NoSqlSession session)
remove
in class NoSqlSessionManager
NoSqlSessionManager.remove(org.eclipse.jetty.nosql.NoSqlSession)
protected void expire(java.lang.String idInCluster)
expire
in class NoSqlSessionManager
NoSqlSessionManager.expire(java.lang.String)
protected void idle()
protected void update(NoSqlSession session, java.lang.String newClusterId, java.lang.String newNodeId) throws java.lang.Exception
update
in class NoSqlSessionManager
java.lang.Exception
NoSqlSessionManager.update(org.eclipse.jetty.nosql.NoSqlSession, java.lang.String, java.lang.String)
protected java.lang.String encodeName(java.lang.String name)
protected java.lang.String decodeName(java.lang.String name)
protected java.lang.Object encodeName(java.lang.Object value) throws java.io.IOException
java.io.IOException
protected java.lang.Object decodeValue(java.lang.Object valueToDecode) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
@ManagedOperation(value="purge invalid sessions in the session store based on normal criteria", impact="ACTION") public void purge()
@ManagedOperation(value="full purge of invalid sessions in the session store", impact="ACTION") public void purgeFully()
@ManagedOperation(value="scavenge sessions known to this manager", impact="ACTION") public void scavenge()
@ManagedOperation(value="scanvenge all sessions", impact="ACTION") public void scavengeFully()
@ManagedAttribute("total number of known sessions in the store") public long getSessionStoreCount()
Copyright © 1995–2017 Webtide. All rights reserved.