@ManagedObject(value="Mongo Session Manager") public class MongoSessionManager extends NoSqlSessionManager
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,
"context" : { "::/contextA" : { "A" : "A",
"__metadata__" : { "version" : NumberLong(2) }
},
"::/contextB" : { "B" : "B",
"__metadata__" : { "version" : NumberLong(1) }
}
},
"created" : NumberLong("1384818548903"),
"expiry" : NumberLong("1384818549903"),
"id" : "w01ijx2vnalgv1sqrpjwuirprp7",
"valid" : true
}
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 and Description |
---|---|
protected class |
MongoSessionManager.ClassLoadingObjectInputStream
ClassLoadingObjectInputStream
|
AbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIf
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Modifier and Type | Field and Description |
---|---|
static String |
__ACCESSED
Last access time of session
|
static String |
__EXPIRY
Time this session will expire, based on last access time and maxIdle
|
static String |
__ID
Session id
|
static String |
__INVALIDATED
Time at which session was invalidated
|
static String |
__MAX_IDLE
The max idle time of a session (smallest value across all contexts which has a session with the same id)
|
static String |
__VALID
Whether or not session is valid
|
static String |
__VERSION
Special attribute per session per context, incremented each time attributes are modified
|
_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 |
---|
MongoSessionManager() |
Modifier and Type | Method and Description |
---|---|
protected String |
decodeName(String name) |
protected Object |
decodeValue(Object valueToDecode) |
void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected Object |
encodeName(Object value) |
protected String |
encodeName(String name) |
protected void |
expire(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 NoSqlSession |
loadSession(String clusterId) |
void |
purge() |
void |
purgeFully() |
protected Object |
refresh(NoSqlSession session,
Object version) |
protected boolean |
remove(NoSqlSession session)
Remove the per-context sub document for this session id.
|
protected Object |
save(NoSqlSession session,
Object version,
boolean activateAfterSave) |
void |
scavenge() |
void |
scavengeFully() |
void |
setSessionIdManager(SessionIdManager metaManager)
Sets the cross context session id manager
|
protected void |
update(NoSqlSession session,
String newClusterId,
String newNodeId)
Change the session id.
|
addSession, getIdlePeriod, getSavePeriod, getSession, getStalePeriod, invalidateSession, isInvalidateOnStop, isPreserveOnStop, isSaveAllAttributes, newSession, removeSession, renewSessionId, setIdlePeriod, setInvalidateOnStop, setPreserveOnStop, setSaveAllAttributes, setSavePeriod, setStalePeriod, shutdownSessions
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, 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
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
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public static final String __ID
public static final String __VALID
public static final String __INVALIDATED
public static final String __ACCESSED
public static final String __EXPIRY
public static final String __MAX_IDLE
public static final String __VERSION
public MongoSessionManager() throws UnknownHostException, com.mongodb.MongoException
UnknownHostException
com.mongodb.MongoException
public void doStart() throws Exception
ContainerLifeCycle
doStart
in class NoSqlSessionManager
Exception
AbstractSessionManager.doStart()
public void setSessionIdManager(SessionIdManager metaManager)
SessionManager
setSessionIdManager
in interface SessionManager
setSessionIdManager
in class AbstractSessionManager
metaManager
- The metaManager used for cross context session management.AbstractSessionManager.setSessionIdManager(org.eclipse.jetty.server.SessionIdManager)
protected Object save(NoSqlSession session, Object version, boolean activateAfterSave)
save
in class NoSqlSessionManager
protected Object refresh(NoSqlSession session, Object version)
refresh
in class NoSqlSessionManager
protected NoSqlSession loadSession(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(String idInCluster)
expire
in class NoSqlSessionManager
NoSqlSessionManager.expire(java.lang.String)
protected void update(NoSqlSession session, String newClusterId, String newNodeId) throws Exception
update
in class NoSqlSessionManager
Exception
NoSqlSessionManager.update(org.eclipse.jetty.nosql.NoSqlSession, java.lang.String, java.lang.String)
protected Object encodeName(Object value) throws IOException
IOException
protected Object decodeValue(Object valueToDecode) throws IOException, ClassNotFoundException
IOException
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(value="total number of known sessions in the store") public long getSessionStoreCount()
Copyright © 1995-2015 Webtide. All Rights Reserved.