public class MongoSessionIdManager extends AbstractSessionIdManager
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener| Modifier and Type | Field and Description |
|---|---|
protected Server |
_server |
protected Set<String> |
_sessionsIds
the collection of session ids known to this manager
TODO consider if this ought to be concurrent or not
|
_random, _weakRandom, _workerName_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING| Constructor and Description |
|---|
MongoSessionIdManager(Server server) |
MongoSessionIdManager(Server server,
com.mongodb.DBCollection sessions) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSession(javax.servlet.http.HttpSession session)
Add a session to the list of known sessions for a given ID.
|
protected void |
doStart() |
protected void |
doStop() |
String |
getClusterId(String nodeId)
Get a cluster ID from a node ID.
|
String |
getNodeId(String clusterId,
javax.servlet.http.HttpServletRequest request)
Get a node ID from a cluster ID and a request
|
long |
getPurgeInvalidAge() |
long |
getPurgeValidAge() |
com.mongodb.DBCollection |
getSessions() |
boolean |
idInUse(String sessionId)
is the session id known to mongo, and is it valid
|
void |
invalidateAll(String sessionId)
Call
HttpSession.invalidate() on all known sessions for the given id. |
boolean |
isPurgeEnabled() |
protected void |
purge()
Purge is a process that cleans the mongodb cluster of old sessions that are no
longer valid.
|
protected void |
purgeFully()
Purge is a process that cleans the mongodb cluster of old sessions that are no
longer valid.
|
void |
removeSession(javax.servlet.http.HttpSession session)
Remove session from the list of known sessions for a given ID.
|
protected void |
scavenge()
Scavenge is a process that periodically checks the tracked session
ids of this given instance of the session id manager to see if they
are past the point of expiration.
|
protected void |
scavengeFully()
ScavengeFully is a process that periodically checks the tracked session
ids of this given instance of the session id manager to see if they
are past the point of expiration.
|
void |
setPurge(boolean purge) |
void |
setPurgeDelay(long purgeDelay) |
void |
setPurgeInvalidAge(long purgeValidAge)
sets how old a session is to be persisted past the point it is
no longer valid
|
void |
setPurgeValidAge(long purgeValidAge)
sets how old a session is to be persist past the point it is
considered no longer viable and should be removed
NOTE: set this value to 0 to disable purging of valid sessions
|
void |
setScavengeDelay(long scavengeDelay)
sets the scavengeDelay
|
void |
setScavengePeriod(long scavengePeriod) |
getRandom, getWorkerName, initRandom, newSessionId, setRandom, setWorkerNameaddLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopprotected Server _server
public MongoSessionIdManager(Server server) throws UnknownHostException, com.mongodb.MongoException
UnknownHostExceptioncom.mongodb.MongoExceptionpublic MongoSessionIdManager(Server server, com.mongodb.DBCollection sessions)
protected void scavenge()
protected void scavengeFully()
protected void purge()
protected void purgeFully()
public com.mongodb.DBCollection getSessions()
public boolean isPurgeEnabled()
public void setPurge(boolean purge)
public void setScavengeDelay(long scavengeDelay)
public void setScavengePeriod(long scavengePeriod)
public void setPurgeDelay(long purgeDelay)
public long getPurgeInvalidAge()
public void setPurgeInvalidAge(long purgeValidAge)
public long getPurgeValidAge()
public void setPurgeValidAge(long purgeValidAge)
protected void doStart()
throws Exception
doStart in class AbstractSessionIdManagerExceptionprotected void doStop()
throws Exception
doStop in class AbstractSessionIdManagerExceptionpublic boolean idInUse(String sessionId)
sessionId - The session ID without any cluster node extensionpublic void addSession(javax.servlet.http.HttpSession session)
SessionIdManagersession - The sessionpublic void removeSession(javax.servlet.http.HttpSession session)
SessionIdManagerpublic void invalidateAll(String sessionId)
SessionIdManagerHttpSession.invalidate() on all known sessions for the given id.sessionId - The session ID without any cluster node extensionpublic String getClusterId(String nodeId)
SessionIdManagerpublic String getNodeId(String clusterId, javax.servlet.http.HttpServletRequest request)
SessionIdManagerclusterId - The ID of the sessionrequest - The request that for the session (or null)Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.