public abstract class ManagerBase extends Object implements Manager
| Modifier and Type | Field and Description |
|---|---|
protected Container |
container
The Container with which this Manager is associated.
|
protected int |
debug
The debugging detail level for this component.
|
protected String |
devRandomSource |
protected boolean |
distributable
The distributable flag for Sessions created by this Manager.
|
protected String |
domain |
protected int |
duplicates |
protected String |
entropy
A String initialization parameter used to increase the entropy of
the initialization of our random number generator.
|
protected int |
expiredSessions
Number of sessions that have expired.
|
protected boolean |
initialized |
protected static Logger |
log |
protected int |
maxActive |
protected Object |
maxActiveUpdateLock |
protected int |
maxInactiveInterval
The default maximum inactive interval for Sessions created by
this Manager.
|
protected static String |
name
The descriptive name of this Manager implementation (for logging).
|
protected ObjectName |
oname |
protected String |
randomClass
The Java class name of the random number generator class to be used
when generating session identifiers.
|
protected DataInputStream |
randomIS |
protected static ResourceBundle |
rb |
protected int |
rejectedSessions
Number of times a session was not created because the maximum number
of active sessions had been reached.
|
protected int |
sessionAverageAliveTime
Average time (in seconds) that expired sessions had been alive.
|
protected int |
sessionCounter |
protected int |
sessionIdLength
The session id length of Sessions created by this Manager.
|
protected SessionLocker |
sessionLocker
A SessionLocker used to lock sessions (curently only
in the request dispatcher forward/include use case)
|
protected int |
sessionMaxAliveTime
The longest time (in seconds) that an expired session had been alive.
|
protected Map<String,Session> |
sessions
The set of currently active Sessions for this Manager, keyed by
session identifier.
|
protected PropertyChangeSupport |
support
The property change support for this component.
|
protected UuidGenerator |
uuidGenerator
The Uuid Generator to be used
when generating universally unique session identifiers.
|
| Constructor and Description |
|---|
ManagerBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Session session)
Add this Session to the set of active Sessions for this Manager.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
|
void |
changeSessionId(Session session)
Change the session ID of the current session to a new randomly generated
session ID.
|
void |
checkSessionAttribute(String name,
Object value)
Checks the given session attribute name and value to make sure they comply with any
restrictions set forth by this session manager.
|
void |
clearSessions()
clear out the sessions cache
HERCULES:added
|
Session |
createEmptySession()
Get a session from the recycled ones or create a new empty one.
|
Session |
createSession()
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
Session |
createSession(String sessionId)
Construct and return a new session object, based on the default
settings specified by this Manager's properties, using the specified
session id.
|
void |
destroy() |
void |
expireSession(String sessionId) |
Session |
findSession(String id)
Return the active Session, associated with this Manager, with the
specified session id (if any); otherwise return
null. |
Session |
findSession(String id,
javax.servlet.http.HttpServletRequest request)
Gets the session with the given id from the given request.
|
Session |
findSession(String id,
String version)
Finds and returns the session with the given id that also satisfies
the given version requirement.
|
Session[] |
findSessions()
Return the set of active Sessions associated with this Manager.
|
protected String |
generateSessionId()
Generate and return a new session identifier.
|
protected String |
generateSessionId(Object obj)
Generate and return a new session identifier.
|
int |
getActiveSessions()
Returns the number of active sessions
|
String |
getClassName()
Returns the name of the implementation class.
|
Container |
getContainer()
Return the Container with which this Manager is associated.
|
int |
getDebug()
Return the debugging detail level for this component.
|
boolean |
getDistributable()
Return the distributable flag for the sessions supported by
this Manager.
|
String |
getDomain() |
int |
getDuplicates()
Number of duplicated session IDs generated by the random source.
|
Engine |
getEngine()
Retrieve the enclosing Engine for this Manager.
|
String |
getEntropy()
Return the entropy increaser value, or compute a semi-useful value
if this String has not yet been set.
|
int |
getExpiredSessions()
Gets the number of sessions that have expired.
|
String |
getInfo()
Return descriptive information about this Manager implementation and
the corresponding version number, in the format
<description>/<version>. |
String |
getJvmRoute()
Retrieve the JvmRoute for the enclosing Engine.
|
String |
getLastAccessedTimeMillis(String sessionId) |
int |
getMaxActive()
Max number of concurent active sessions
|
int |
getMaxInactiveInterval()
Same as getMaxInactiveIntervalSeconds
|
int |
getMaxInactiveIntervalSeconds()
Return the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
String |
getName()
Return the descriptive short name of this Manager implementation.
|
protected StandardSession |
getNewSession()
Get new session class to be used in the doLoad() method.
|
ObjectName |
getObjectName() |
Random |
getRandom()
Return the random number generator instance we should use for
generating session identifiers.
|
protected void |
getRandomBytes(byte[] bytes) |
String |
getRandomClass()
Return the random number generator class name.
|
String |
getRandomFile() |
int |
getRejectedSessions()
Gets the number of session creations that failed due to
maxActiveSessions
|
String |
getSessionAttribute(String sessionId,
String key)
For debugging: get a session attribute
|
int |
getSessionAverageAliveTime()
Same as getSessionAverageAliveTimeSeconds
|
int |
getSessionAverageAliveTimeSeconds()
Gets the average time (in seconds) that expired sessions had been
alive.
|
int |
getSessionCount()
Total sessions created by this manager.
|
int |
getSessionCounter()
Same as getSessionCount
|
int |
getSessionIdLength()
Gets the session id length (in bytes) of Sessions created by
this Manager.
|
int |
getSessionMaxAliveTime()
Same as getSessionMaxAliveTimeSeconds
|
int |
getSessionMaxAliveTimeSeconds()
Gets the longest time (in seconds) that an expired session had been
alive.
|
UuidGenerator |
getUuidGenerator()
Return the UuidGenerator for this Manager.
|
void |
init() |
boolean |
isSessionVersioningSupported()
Returns true if this session manager supports session versioning, false
otherwise.
|
String |
listSessionIds()
For debugging: return a list of all session ids currently active
|
boolean |
lockSession(javax.servlet.ServletRequest request) |
protected void |
log(String message)
Deprecated.
|
protected void |
log(String message,
Throwable throwable)
Deprecated.
|
void |
postRequestDispatcherProcess(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
void |
preRequestDispatcherProcess(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
void |
release() |
void |
remove(Session session)
Remove this Session from the active Sessions for this Manager.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
|
protected void |
resetRandom()
Reset the random number generator instance to null.
|
void |
setContainer(Container container)
Set the Container with which this Manager is associated.
|
void |
setDebug(int debug)
Set the debugging detail level for this component.
|
void |
setDistributable(boolean distributable)
Set the distributable flag for the sessions supported by this
Manager.
|
void |
setDuplicates(int duplicates) |
void |
setEntropy(String entropy)
Set the entropy increaser value.
|
void |
setExpiredSessions(int expiredSessions)
Sets the number of sessions that have expired.
|
void |
setMaxActive(int maxActive)
(Re)sets the maximum number of sessions that have been active at the
same time.
|
void |
setMaxInactiveInterval(int interval)
Same as setMaxInactiveIntervalSeconds
|
void |
setMaxInactiveIntervalSeconds(int interval)
Set the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
void |
setRandomClass(String randomClass)
Set the random number generator class name.
|
void |
setRandomFile(String s)
Use /dev/random-type special device.
|
void |
setRejectedSessions(int rejectedSessions)
Sets the number of sessions that were not created because the maximum
number of active sessions was reached.
|
void |
setSessionAverageAliveTime(int sessionAverageAliveTime)
Same as setSessionAverageAliveTimeSeconds
|
void |
setSessionAverageAliveTimeSeconds(int sessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been
alive.
|
void |
setSessionCount(int sessionCounter)
Sets the total number of sessions created by this manager.
|
void |
setSessionCounter(int sessionCounter)
Same as setSessionCount
|
void |
setSessionIdLength(int idLength)
Sets the session id length (in bytes) for Sessions created by this
Manager.
|
void |
setSessionLocker(SessionLocker sessLocker)
set the pluggable sessionLocker for this manager
by default it is pre-set to no-op BaseSessionLocker
|
void |
setSessionMaxAliveTime(int sessionMaxAliveTime)
Same as setSessionMaxAliveTimeSeconds
|
void |
setSessionMaxAliveTimeSeconds(int sessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been
alive.
|
void |
setUuidGenerator(UuidGenerator aUuidGenerator)
Set the UuidGenerator for this Manager.
|
javax.servlet.http.Cookie |
toCookie(Session session)
Converts the given session into a cookie as a way of persisting it.
|
void |
unlockSession(javax.servlet.ServletRequest request) |
void |
update(javax.servlet.http.HttpSession session)
Perform any operations when the request is finished.
|
protected static final Logger log
protected static final ResourceBundle rb
protected DataInputStream randomIS
protected String devRandomSource
protected Container container
protected int debug
protected boolean distributable
true, any user attributes added to a
session controlled by this Manager must be Serializable.protected String entropy
protected SessionLocker sessionLocker
protected int maxInactiveInterval
protected int sessionIdLength
protected static final String name
protected UuidGenerator uuidGenerator
protected String randomClass
protected int sessionMaxAliveTime
protected int sessionAverageAliveTime
protected int expiredSessions
protected Map<String,Session> sessions
protected int sessionCounter
protected volatile int maxActive
protected final Object maxActiveUpdateLock
protected int duplicates
protected boolean initialized
protected PropertyChangeSupport support
protected int rejectedSessions
protected String domain
protected ObjectName oname
public UuidGenerator getUuidGenerator()
public void setUuidGenerator(UuidGenerator aUuidGenerator)
public Container getContainer()
getContainer in interface Managerpublic void setContainer(Container container)
setContainer in interface Managercontainer - The newly associated Containerpublic int getDebug()
public void setDebug(int debug)
debug - The new debugging detail levelpublic String getClassName()
public boolean getDistributable()
getDistributable in interface Managerpublic void setDistributable(boolean distributable)
setDistributable in interface Managerdistributable - The new distributable flagpublic String getEntropy()
public void setEntropy(String entropy)
entropy - The new entropy increaser valuepublic String getInfo()
<description>/<version>.public int getMaxInactiveInterval()
getMaxInactiveInterval in interface Managerpublic int getMaxInactiveIntervalSeconds()
getMaxInactiveIntervalSeconds in interface Managerpublic void setMaxInactiveInterval(int interval)
setMaxInactiveInterval in interface Managerpublic void setMaxInactiveIntervalSeconds(int interval)
setMaxInactiveIntervalSeconds in interface Managerinterval - The new default valuepublic int getSessionIdLength()
getSessionIdLength in interface Managerpublic void setSessionIdLength(int idLength)
setSessionIdLength in interface ManageridLength - The session id lengthpublic int getRejectedSessions()
getRejectedSessions in interface Managerpublic void setRejectedSessions(int rejectedSessions)
setRejectedSessions in interface ManagerrejectedSessions - Number of rejected sessionspublic String getName()
public void setRandomFile(String s)
public String getRandomFile()
public Random getRandom()
protected void resetRandom()
public String getRandomClass()
public void setRandomClass(String randomClass)
randomClass - The new random number generator class namepublic int getExpiredSessions()
getExpiredSessions in interface Managerpublic void setExpiredSessions(int expiredSessions)
setExpiredSessions in interface ManagerexpiredSessions - Number of sessions that have expiredpublic void setSessionLocker(SessionLocker sessLocker)
public void destroy()
public void init()
public void add(Session session)
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in interface Managerlistener - The listener to addpublic Session createSession()
null.
Hercules: modifiedcreateSession in interface ManagerIllegalStateException - if a new session cannot be
instantiated for any reasonpublic Session createSession(String sessionId)
createSession in interface ManagersessionId - the session id to assign to the new sessionnull if a session with the
requested id already existsIllegalStateException - if a new session cannot be
instantiated for any reasonpublic Session createEmptySession()
createEmptySession in interface Managerpublic void checkSessionAttribute(String name, Object value)
ManagercheckSessionAttribute in interface Managername - the session attribute namevalue - the session attribute valuepublic Session findSession(String id) throws IOException
null.findSession in interface Managerid - The session id for the session to be returnedIllegalStateException - if a new session cannot be
instantiated for any reasonIOException - if an input/output error occurs while
processing this requestpublic Session findSession(String id, javax.servlet.http.HttpServletRequest request) throws IOException
ManagerfindSession in interface Managerid - the session idrequest - the request containing the requested session informationIOExceptionpublic Session findSession(String id, String version) throws IOException
findSession in interface Managerid - The session id to matchversion - The session version requirement to satisfyIOException - if an IO error occurredpublic boolean isSessionVersioningSupported()
isSessionVersioningSupported in interface Managerpublic void clearSessions()
public Session[] findSessions()
findSessions in interface Managerpublic void remove(Session session)
public javax.servlet.http.Cookie toCookie(Session session) throws IOException
ManagertoCookie in interface Managersession - the session to convertIOExceptionpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in interface Managerlistener - The listener to removepublic void changeSessionId(Session session)
changeSessionId in interface Managersession - The session to change the session ID forprotected StandardSession getNewSession()
protected void getRandomBytes(byte[] bytes)
protected String generateSessionId(Object obj)
protected String generateSessionId()
public Engine getEngine()
public String getJvmRoute()
protected void log(String message)
message - Message to be loggedprotected void log(String message, Throwable throwable)
message - Message to be loggedthrowable - Associated exceptionpublic void setSessionCounter(int sessionCounter)
setSessionCounter in interface Managerpublic void setSessionCount(int sessionCounter)
ManagersetSessionCount in interface ManagersessionCounter - Total number of sessions created by this manager.public int getSessionCounter()
getSessionCounter in interface Managerpublic int getSessionCount()
getSessionCount in interface Managerpublic int getDuplicates()
public void setDuplicates(int duplicates)
public int getActiveSessions()
getActiveSessions in interface Managerpublic int getMaxActive()
getMaxActive in interface Managerpublic void setMaxActive(int maxActive)
ManagersetMaxActive in interface ManagermaxActive - Maximum number of sessions that have been active at
the same time.public int getSessionMaxAliveTime()
getSessionMaxAliveTime in interface Managerpublic int getSessionMaxAliveTimeSeconds()
getSessionMaxAliveTimeSeconds in interface Managerpublic void setSessionMaxAliveTime(int sessionMaxAliveTime)
setSessionMaxAliveTime in interface Managerpublic void setSessionMaxAliveTimeSeconds(int sessionMaxAliveTime)
setSessionMaxAliveTimeSeconds in interface ManagersessionMaxAliveTime - Longest time (in seconds) that an expired
session had been alive.public int getSessionAverageAliveTime()
getSessionAverageAliveTime in interface Managerpublic int getSessionAverageAliveTimeSeconds()
getSessionAverageAliveTimeSeconds in interface Managerpublic void setSessionAverageAliveTime(int sessionAverageAliveTime)
setSessionAverageAliveTime in interface Managerpublic void setSessionAverageAliveTimeSeconds(int sessionAverageAliveTime)
setSessionAverageAliveTimeSeconds in interface ManagersessionAverageAliveTime - Average time (in seconds) that expired
sessions had been alive.public String listSessionIds()
public String getSessionAttribute(String sessionId, String key)
sessionId - key - public void expireSession(String sessionId)
public void update(javax.servlet.http.HttpSession session)
throws Exception
public ObjectName getObjectName()
public String getDomain()
public void postRequestDispatcherProcess(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
postRequestDispatcherProcess in interface Managerpublic void preRequestDispatcherProcess(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
preRequestDispatcherProcess in interface Managerpublic boolean lockSession(javax.servlet.ServletRequest request)
throws javax.servlet.ServletException
lockSession in interface Managerjavax.servlet.ServletExceptionpublic void unlockSession(javax.servlet.ServletRequest request)
unlockSession in interface Managerpublic void release()
Copyright © 2017. All rights reserved.