|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle org.eclipse.jetty.server.session.AbstractSessionIdManager org.eclipse.jetty.nosql.mongodb.MongoSessionIdManager
public class MongoSessionIdManager
Based partially on the jdbc session id manager... Theory is that we really only need the session id manager for the local instance so we have something to scavenge on, namely the list of known ids this class has a timer that runs at the scavenge delay that runs a query for all id's known to this node and that have and old accessed value greater then the scavengeDelay. these found sessions are then run through the invalidateAll(id) method that is a bit hinky but is supposed to notify all handlers this id is now DOA and ought to be cleaned up. this ought to result in a save operation on the session that will change the valid field to false (this conjecture is unvalidated atm)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
AbstractLifeCycle.AbstractLifeCycleListener |
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
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 |
Fields inherited from class org.eclipse.jetty.server.session.AbstractSessionIdManager |
---|
_random, _weakRandom, _workerName |
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
MongoSessionIdManager(Server server)
|
|
MongoSessionIdManager(Server server,
com.mongodb.DBCollection sessions)
|
Method Summary | |
---|---|
void |
addSession(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,
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(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)
|
Methods inherited from class org.eclipse.jetty.server.session.AbstractSessionIdManager |
---|
getRandom, getWorkerName, initRandom, newSessionId, setRandom, setWorkerName |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Field Detail |
---|
protected Server _server
protected final Set<String> _sessionsIds
Constructor Detail |
---|
public MongoSessionIdManager(Server server) throws UnknownHostException, com.mongodb.MongoException
UnknownHostException
com.mongodb.MongoException
public MongoSessionIdManager(Server server, com.mongodb.DBCollection sessions)
Method Detail |
---|
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 AbstractSessionIdManager
Exception
protected void doStop() throws Exception
doStop
in class AbstractSessionIdManager
Exception
public boolean idInUse(String sessionId)
sessionId
- The session ID without any cluster node extension
public void addSession(HttpSession session)
SessionIdManager
session
- The sessionpublic void removeSession(HttpSession session)
SessionIdManager
public void invalidateAll(String sessionId)
SessionIdManager
HttpSession.invalidate()
on all known sessions for the given id.
sessionId
- The session ID without any cluster node extensionpublic String getClusterId(String nodeId)
SessionIdManager
public String getNodeId(String clusterId, HttpServletRequest request)
SessionIdManager
clusterId
- The ID of the sessionrequest
- The request that for the session (or null)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |