public abstract class AbstractSessionIdManager extends AbstractLifeCycle implements SessionIdManager
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
protected Random |
_random |
protected long |
_reseed |
protected boolean |
_weakRandom |
protected String |
_workerAttr |
protected String |
_workerName |
Constructor and Description |
---|
AbstractSessionIdManager() |
AbstractSessionIdManager(Random random) |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop() |
String |
getClusterId(String nodeId)
Get the session ID without any worker ID.
|
String |
getNodeId(String clusterId,
javax.servlet.http.HttpServletRequest request)
Get the session ID with any worker ID.
|
Random |
getRandom() |
long |
getReseed() |
String |
getWorkerName()
Get the workname.
|
void |
initRandom()
Set up a random number generator for the sessionids.
|
String |
newSessionId(javax.servlet.http.HttpServletRequest request,
long created)
Create a new session id if necessary.
|
String |
newSessionId(long seedTerm) |
abstract void |
renewSessionId(String oldClusterId,
String oldNodeId,
javax.servlet.http.HttpServletRequest request)
Change the existing session id.
|
void |
setRandom(Random random) |
void |
setReseed(long reseed)
Set the reseed probability.
|
void |
setWorkerName(String workerName)
Set the workername.
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSession, idInUse, invalidateAll, removeSession
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
protected Random _random
protected boolean _weakRandom
protected String _workerName
protected String _workerAttr
protected long _reseed
public AbstractSessionIdManager()
public AbstractSessionIdManager(Random random)
public String getWorkerName()
getWorkerName
in interface SessionIdManager
public void setWorkerName(String workerName)
workerName
- the name of the workerpublic Random getRandom()
public void setRandom(Random random)
public 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(javax.servlet.http.HttpServletRequest request, long created)
newSessionId
in interface SessionIdManager
request
- the request with the sesioncreated
- the timestamp for when the session was createdSessionIdManager.newSessionId(javax.servlet.http.HttpServletRequest, long)
public String newSessionId(long seedTerm)
public abstract void renewSessionId(String oldClusterId, String oldNodeId, javax.servlet.http.HttpServletRequest request)
SessionIdManager
renewSessionId
in interface SessionIdManager
oldClusterId
- the old cluster idoldNodeId
- the old node idrequest
- the request containing the sessionprotected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public void initRandom()
public String getNodeId(String clusterId, javax.servlet.http.HttpServletRequest request)
getNodeId
in interface SessionIdManager
clusterId
- the cluster idrequest
- the requestpublic String getClusterId(String nodeId)
getClusterId
in interface SessionIdManager
nodeId
- the node idCopyright © 1995-2015 Webtide. All Rights Reserved.