public class DefaultSessionIdManager extends ContainerLifeCycle implements SessionIdManager
HouseKeeperAbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
protected HouseKeeper |
_houseKeeper |
protected boolean |
_ownHouseKeeper |
protected Random |
_random |
protected long |
_reseed |
protected Server |
_server |
protected boolean |
_weakRandom |
protected String |
_workerAttr |
protected String |
_workerName |
protected static AtomicLong |
COUNTER |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| Constructor and Description |
|---|
DefaultSessionIdManager(Server server) |
DefaultSessionIdManager(Server server,
Random random) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart() |
protected void |
doStop() |
void |
expireAll(String id)
Remove an id from use by telling all contexts to remove a session with this id.
|
String |
getExtendedId(String clusterId,
HttpServletRequest request)
Get the session ID with any worker ID.
|
String |
getId(String extendedId)
Get the session ID without any worker ID.
|
Random |
getRandom() |
long |
getReseed() |
Server |
getServer() |
Set<SessionHandler> |
getSessionHandlers()
Get SessionManager for every context.
|
HouseKeeper |
getSessionHouseKeeper() |
String |
getWorkerName()
Get the workname.
|
void |
initRandom()
Set up a random number generator for the sessionids.
|
void |
invalidateAll(String id)
Invalidate all sessions on all contexts that share the same id.
|
boolean |
isIdInUse(String id) |
String |
newSessionId(HttpServletRequest request,
long created)
Create a new session id if necessary.
|
String |
newSessionId(long seedTerm) |
String |
renewSessionId(String oldClusterId,
String oldNodeId,
HttpServletRequest request)
Generate a new id for a session and update across
all SessionManagers.
|
void |
setRandom(Random random) |
void |
setReseed(long reseed)
Set the reseed probability.
|
void |
setServer(Server server) |
void |
setSessionHouseKeeper(HouseKeeper houseKeeper) |
void |
setWorkerName(String workerName)
Set the workername.
|
String |
toString() |
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, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopprotected static final AtomicLong COUNTER
protected Random _random
protected boolean _weakRandom
protected String _workerName
protected String _workerAttr
protected long _reseed
protected Server _server
protected HouseKeeper _houseKeeper
protected boolean _ownHouseKeeper
public DefaultSessionIdManager(Server server)
server - the server associated with the id managerpublic void setServer(Server server)
server - the server associated with this id managerpublic Server getServer()
public void setSessionHouseKeeper(HouseKeeper houseKeeper)
setSessionHouseKeeper in interface SessionIdManagerhouseKeeper - the housekeeperpublic HouseKeeper getSessionHouseKeeper()
getSessionHouseKeeper in interface SessionIdManagerpublic String getWorkerName()
getWorkerName in interface SessionIdManagerpublic void setWorkerName(String workerName)
workerName - the name of the worker, if null it is coerced to empty stringpublic Random getRandom()
public void setRandom(Random random)
random - a random number generator for generating idspublic long getReseed()
public void setReseed(long reseed)
reseed - If non zero then when a random long modulo the reseed value == 1, the SecureRandom will be reseeded.public String newSessionId(HttpServletRequest request, long created)
newSessionId in interface SessionIdManagerrequest - the request with the sesioncreated - the timestamp for when the session was createdSessionIdManager.newSessionId(javax.servlet.http.HttpServletRequest, long)public String newSessionId(long seedTerm)
seedTerm - the seed for RNGpublic boolean isIdInUse(String id)
isIdInUse in interface SessionIdManagerid - The plain session ID (ie no workername extension)SessionIdManager.isIdInUse(java.lang.String)protected void doStart()
throws Exception
doStart in class ContainerLifeCycleExceptionAbstractLifeCycle.doStart()protected void doStop()
throws Exception
doStop in class ContainerLifeCycleExceptionAbstractLifeCycle.doStop()public void initRandom()
public String getExtendedId(String clusterId, HttpServletRequest request)
getExtendedId in interface SessionIdManagerclusterId - the cluster idrequest - the requestpublic String getId(String extendedId)
getId in interface SessionIdManagerextendedId - the session id with the worker extensionpublic void expireAll(String id)
expireAll in interface SessionIdManagerid - The session ID without any cluster node extensionSessionIdManager.expireAll(java.lang.String)public void invalidateAll(String id)
SessionIdManagerinvalidateAll in interface SessionIdManagerid - the session idpublic String renewSessionId(String oldClusterId, String oldNodeId, HttpServletRequest request)
renewSessionId in interface SessionIdManageroldClusterId - the old plain session idoldNodeId - the old fully qualified idrequest - the request containing the sessionSessionIdManager.renewSessionId(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)public Set<SessionHandler> getSessionHandlers()
getSessionHandlers in interface SessionIdManagerpublic String toString()
toString in class ObjectObject.toString()Copyright © 1995–2017 Webtide. All rights reserved.